Home > Backend Development > PHP Tutorial > 加了个<就无法匹配到结果了

加了个<就无法匹配到结果了

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:56:16
Original
794 people have browsed it

求助: 加了个

<br />$str='adfefdfdf<if codition=("{$name} eq 1")>2014/5/2fafefdfef。';<br />preg_match_all('#if\s+codition=(.*)\s*>#U',$str,$arr);<br />echo '<pre class="brush:php;toolbar:false">';<br />print_r($arr);<br />
Copy after login

没有<得到的结果是
<br />Array<br />(<br />    [0] => Array<br />        (<br />            [0] => if codition=("{$name} eq 1")><br />        )<br /><br />    [1] => Array<br />        (<br />            [0] => ("{$name} eq 1")<br />        )<br /><br />)<br />
Copy after login


有<
<br />$str='adfefdfdf<if codition=("{$name} eq 1")>2014/5/2fafefdfef。';<br />preg_match_all('#<if\s+codition=(.*)\s*>#U',$str,$arr);<br />echo '<pre class="brush:php;toolbar:false">';<br />print_r($arr);<br />
Copy after login

的结果
<br />Array<br />(<br />    [0] => Array<br />        (<br />            [0] => <br />        )<br /><br />    [1] => Array<br />        (<br />            [0] => ("{$name} eq 1")<br />        )<br /><br />)<br /><br />
Copy after login

为什么加了个
------解决方案--------------------
你在浏览器中看一下源文件就知道了

 被浏览器解释为 html 标记了
用 pre 是阻止不了的,要用 xmp 才行

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