//创建缓存目录<br />$dir="cache";<br />[email protected]($dir); <br />if(!$fileDir){<br /> echo '打开目录失败';<br /> exit;<br />}<br />while(false!==([email protected]($fileDir))){<br /> //跳过本目录以及上级目录<br /> if ('.' === $file || '..' === $file) continue; <br /> //获取文件后缀<br /> $filetype=substr($file,strripos($file,".")+1); <br /> //文件路径<br /> $filepath=$dir.'/'.$file; <br /> //判断是不是php文件,并判断是否存在<br /> if($filetype=='php' && is_file($filepath)){<br /> $handle = fopen($filepath,"r"); <br /> $contents.= fread($handle,filesize($filepath)); <br /> fclose($handle);<br /> } <br />}<br />write('data.php',"<?php\r\n\$listDB=".var_export($contents,true).";\r\n?>");$contents.= rtrim(ltrim(fread($handle,filesize($v)),'<?php'),'?>');
$dir = "cache";<br />$out = 'data.php';<br />file_put_contents($out);<br />foreach(glob("$dir/*.php") as $fn) {<br /> file_put_contents($out, file_get_contents($fn), FILE_APPEND);<br />}<br /> //获取文件后缀 并确定是否为php后缀<br />if(substr($file, -4)== '.php'){<br /> .........<br />}<br />
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号