Home > Backend Development > PHP Tutorial > php正则截取解决思路

php正则截取解决思路

WBOY
Release: 2016-06-13 13:22:14
Original
811 people have browsed it

php正则截取
想要截取别人网站中的一段div,正则不太懂,截取不成功。代码如下:

$str = file_get_contents("http://cp.360.cn/jczq/?src=menu");
$preg = '/^

(.*?)/i';
preg_match($preg,$str,$match);
var_dump($match);exit;
?>

------解决方案--------------------
/
(.*?)/i
------解决方案--------------------

/
(.*?)/is

加上s
探讨

/
(.*?)/i

------解决方案--------------------
s是王道.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template