<?php
 ....
?>
<html>
<head>
</head>

<body>
   .....
</body>

</html>
红字部分为欲删除内容
注:是文件中<body>标签的代码要删掉

解决方案 »

  1.   

    preg_replace(/\<body\>.*\<\/body\>/, '', file_get_contents('你的文件名'));
      

  2.   

    正则表达式绝对是必要的 `
    既然body都不要了.head也一并删了吧.哈哈 `~
      

  3.   


        str_replace('<body>','',$yourFile);
      

  4.   

    preg_replace('!^<body (.*)?>.*</\body>$!','',file_get_content('你的文件名'));
      

  5.   


    //$str 当然,用file_get_content(filePath)获取比较方便
    $str = '<html>
    <head>
    </head><body>
    .....
    </body></html>
    ';
    echo preg_replace('/<body>.*<\/body>/s', '', $str);