1. PHP 内置函数 get_meta_tags
获取description 和 keywords用:
1. PHP 内置函数 get_meta_tags
$meta_array
= get_meta_tags(
'https://mimvp.com'
);
var_dump(
$meta_array
);
获取title用:
<?php
$content=file_get_contents("https://www.jb51.net/");
$pos = strpos($content,'utf-8');
if($pos===false){$content = iconv("gbk","utf-8",$content);}
$postb=strpos($content,'<title>')+7;
$poste=strpos($content,'</title>');
$length=$poste-$postb;
echo substr($content,$postb,$length);
?>
本文介绍如何使用PHP内置函数get_meta_tags获取网页的description和keywords,并演示了如何抓取网页的title。通过简单的代码示例,展示了从指定URL中提取元信息的方法。
4593

被折叠的 条评论
为什么被折叠?



