Html 如何获取网页元标签的内容
我正在尝试读取安全网页的元标记的内容。但发现它很困难,因为属性不是一般的一个,如名称,作者等。如果他们有任何可能的方式,请告诉Html 如何获取网页元标签的内容,html,tags,meta,Html,Tags,Meta,我正在尝试读取安全网页的元标记的内容。但发现它很困难,因为属性不是一般的一个,如名称,作者等。如果他们有任何可能的方式,请告诉 提前谢谢。你在php.net上看过这些帖子了吗 <meta name="author" content="name"> <meta name="keywords" content="php documentation"> <meta name="DESCRIPTION" content="a php manual"> <meta
提前谢谢。你在php.net上看过这些帖子了吗
<meta name="author" content="name">
<meta name="keywords" content="php documentation">
<meta name="DESCRIPTION" content="a php manual">
<meta name="geo.position" content="49.33;-86.59">
</head> <!-- parsing stops here -->
使用下面编写的php代码阅读这些元标记
<?php
// Assuming the above tags are at www.example.com
$tags = get_meta_tags('http://www.example.com/');
// Notice how the keys are all lowercase now, and
// how . was replaced by _ in the key.
echo $tags['author']; // name
echo $tags['keywords']; // php documentation
echo $tags['description']; // a php manual
echo $tags['geo_position']; // 49.33;-86.59
?>
这些代码取自,请看一看