Heim  >  Artikel  >  Backend-Entwicklung  >  有关PHP正则,提取网页指定内容的有关问题

有关PHP正则,提取网页指定内容的有关问题

PHP中文网
PHP中文网Original
2016-06-13 11:48:32977Durchsuche

  有关PHP正则,提取网页指定内容的问题。
有关PHP正则,提取网页指定内容的问题。

源码:

<META name="httpfileurl" content=" http://stor.vdisk.cn/loadfile/C8/CE8%B5%84%E6%BA%90%
E7%9B%92%E4%BD%BF%E7%94%A8%E6on%95%99%E7%A8%8B.mp4">

请问怎么把content=后面的链接地址提取出来?

------解决方案--------------------
引用:

Quote: 引用:

$content = &#39;<META name="httpfileurl" 
content=" http://stor.vdisk.cn/loadfile/C8/CE8%B5%84%E6%BA%90%E7%9B%92%E4%BD%BF%E7%94%A8%E6on%95%99%E7%A8%8B.mp4">&#39;;
	
	$content = preg_match("
------解决方案--------------------
content=\"(.*)\"
------解决方案--------------------
",$content,$match);
	echo($match[1]);

代码是这样子的

<META content="天之痕主题曲.mp3" name="description"> 
<META name="httpfileurl" 
content=" 
key=28bac3a4334746589415441857456dbe&tt=1391937000&st=YvMccoIvFIpSWAONSEnNfA&filename=%E5%A4%A9%E4%B9%8B%E7%97%95%E
$content = preg_match("
------解决方案--------------------
\"httpfileurl\"(\s+)?content=\"(.*)\"
------解决方案--------------------
",$content,$match);
echo $match[2];

以上就是有关PHP正则,提取网页指定内容的有关问题的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn