CodeIgniter:帮助从网页获取元标记的类/库? [英] CodeIgniter: A Class/Library to help get meta tags from a web page?

查看:137
本文介绍了CodeIgniter:帮助从网页获取元标记的类/库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用codeigniter。我想使用哪个php框架无关紧要。

I am using codeigniter. I guess it doesn't matter which php framework I am using.

但在我写我自己的类之前,还有一个已经写的,允许用户得到

But before I write my own class is there another that has already been written that allows a user to get the page title and meta tags (keywords, descriptions) of any sit...if they have any.

任何类型的PHP类都能做到这一点。

Any sort of PHP class that does that would be great.

感谢所有

推荐答案

PHP Simple HTML DOM 它的工作方式如下:

include('simple_html_dom.php');
$html = file_get_html('http://www.codeigniter.com/');

echo $html->find('title', 0)->innertext; // get <title>

echo "<pre>";
foreach($html->find('meta') as $element)
       echo $element->name . " : " . $element->content  . '<br>'; //prints every META tag

echo "</pre>";

这篇关于CodeIgniter:帮助从网页获取元标记的类/库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆