PHP根据文章标记自动切割分类为文本。

来源:互联网 发布:20岁长高的秘诀 知乎 编辑:程序博客网 时间:2024/06/05 19:47

<?php$file=<<<html#file block/head.html<script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript" src="js/jquery.cxslide.min.js"></script><script type="text/javascript" src="js/custome.js"></script></head><body class="body_index"><!--顶部 开始--><div id="top_main">  <div id="top">    <div id="top_2"><a href="" target="_blank"><span class="MobileEdition">[手机版] </span></a></div>  </div></div>#file blocks/foot.html<!--顶部 结束--><!--Logo 开始--><div id="logo_main">  <div id="logo"><!--网站Logo 开始-->    <div class="WebLogo"><a href="/" target="_self"><img  src="images/logo.png" title="" alt="" /></a></div>    <!--网站Logo 结束--></div></div><!--Logo 结束--><!--导航条 开始--><div id="navigation_main">  <div id="navigation">    <ul class="navigationlist">#file body.htmlhtml;//$file=file_get_contents("index.html");$list=explode("#file",$file);array_shift($list);foreach($list as $key){$outfile="";$filename="";$outfile=split("\r\n",$key);$filename=trim($outfile[0]);$path=pathinfo($filename,PATHINFO_DIRNAME);if(!empty($path)){if(!file_exists($path)){mkdir($path);}}array_shift($outfile);$outfile=implode("\r\n",$outfile);file_put_contents($filename,$outfile);}echo "done.";?>


切割标记:#file 文件保存路径


0 0
原创粉丝点击