PHP正则表达式获取字符串之间的内容

        正则表达式很强大,今天分享的这个经常使用。

$url = @$_GET["url"];
$info=@file_get_contents($url);
preg_match('/<title>(.*?)</title>/',$info,$title);
echo $title;
$url = @$_GET["url"];
$info=@file_get_contents($url);
preg_match('/<title>(.*?)</title>/',$info,$title);
echo $title;
$url = @$_GET["url"]; $info=@file_get_contents($url); preg_match('/<title>(.*?)</title>/',$info,$title); echo $title;

        可以用上面这个获取网页的网页标题。

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享
If we dream, everything is possible.
敢于梦想,一切都将成为可能
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容