版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。http://blog.csdn.net/mayongzhan - 马永占,myz,mayongzhan
---------------------------------------------------- get_meta_tags()
解析目标:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="all" name="robots" />
<meta name="keywords" content="关键字,关键字2,charset=utf-8" />
<meta name="author" content="mayongzhan" />
<meta name="copyright" content="非本站同意,禁止转载,agree to copy when i allow you" />
<meta name="description" content="描述" />
<title>无标题文档</title>
</head>
<body>
test
</body>
</html>
程序:
<?php
/**
* @name test.php
* @date Sun Jan 19 10:15:26 CST 2008
* @copyright 马永占(MyZ)
* @author 马永占(MyZ)
* @link http://blog.csdn.net/mayongzhan/
*/
$tags=get_meta_tags('http://127.0.0.1/test.html');
print_r($tags) ;
?>
$tags=get_meta_tags('http://127.0.0.1/test.html');
print_r($tags) ;
?>
结果
Array ( [robots] => all [keywords] => 关键字,关键字2,charset=utf-8 [author] => mayongzhan [copyright] => 非本站同意,禁止转载,agree to copy when i allow you [description] => 描述 )