Home >Backend Development >PHP Tutorial > 一个正则有关问题
一个正则问题
$str=1主题内容与适用范围 <div id="divPdf1" title="../2003Z/hb/z063.pdf#page=2" class="downpdf" style="cursor:hand;">2原理</div> <div id="divPdf2" title="../2003Z/hb/z063.pdf#page=2" class="downpdf" style="cursor:hand;">3试剂</div> <div id="divPdf3" title="../2003Z/hb/z063.pdf#page=4" class="downpdf" style="cursor:hand;">4仪器、设备</div> <div id="divPdf4" title="../2003Z/hb/z063.pdf#page=4" class="downpdf" style="cursor:hand;">5采样及样品保存</div> STR; preg_match('/<div. echo></div.><font color="#e78608">------解决方案--------------------</font><br>preg_match('/title="([^#\"]+)#/s',$s,$m);<br>prinit_r($m[1]); <br><font color="#e78608">------解决方案--------------------</font><br>/<img src="%5C/images%5C/(.*?)" alt=" 一个正则有关问题 " ><font color="#e78608">------解决方案--------------------</font><br>/<img src="%5C/images%5C/(.*)" alt=" 一个正则有关问题 " ><font color="#e78608">------解决方案--------------------</font><br> $contents = $match[1];<br>foreach($contents as &$v) $v='http://localhost/'.$v;<br> $contents = implode('#',$contents);<br> echo $contents; <div class="clear"> </div>