>  기사  >  백엔드 개발  >  正则不会 求解决解决办法

正则不会 求解决解决办法

WBOY
WBOY원래의
2016-06-13 13:36:50667검색

正则不会 求解决
怎么用正则删除网页的head 和 foot部分
页面是生成的  

或者有其他方法 删除网页的head 和 foot部分 请赐教

------解决方案--------------------
删除掉

以外的部分?
来个范例.
------解决方案--------------------
若是这样:你可以试一下:
PHP code

$string = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta content="正则不会 求解决 PHP 基础编程" name="Keywords"><meta content="怎么用正则删除网页 head 和 foot部分 页面是生成 或者有其他方法 删除网页 head 和 foot部分 请赐教" name="description"><title>正则不会  求解决 - PHP / 基础编程</title><link href="http://c.csdn.net/bbs/t/5/t5.css" rel="stylesheet" type="text/css">dsgfdg<br><foot> <span style="color:red">dsgfdg</span></foot>';
$pattern = '/(<head.>.*)|(<foot.>.*)/i';
print preg_replace($pattern, '', $string); <div class="clear">
                 
              
              
        
            </div></foot.></head.>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.