Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何获取网页元标签的内容_Html_Tags_Meta - Fatal编程技术网

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
?>

这些代码取自

,请看一看