<?php
function d_rmdir($dirname) { //删除非空目录
if(!is_dir($dirname)) {
return false;
}
$handle = @opendir($dirname);
while(($file = @readdir($handle)) !== false){
if($file != '.' && $file != '..'){
$dir = $dirname . '/' . $file;
is_dir($dir) ? d_rmdir($dir) : unlink($dir);
}
}
closedir($handle);
return rmdir($dirname) ;
}
// if(unlink("F:/111www/1111111111111/test/test2.php")){ //删除文件
// if(rmdir("F:/111www/1111111111111/test/222")){ //删除空文件夹
if(d_rmdir("./111")){
echo "删除成功";
}else{
echo "删除失败";
}
?>
chmod("/somedir/somefile", 755); //赋权限
$arr = explode("/Application",dirname(__FILE__));
$ordPath = $arr[0].'/Public/aj/index.html';
$newPath = $arr[0].'/Application/Stage/View/Index/index'.$id.'.html';
$state = copy($ordPath,$newPath); //拷贝文件
$test = file_get_contents($ordPath); //获得文件内容
$temp = str_replace('%keywords%',$description, $test); //替换内容
$isTrue = file_put_contents($newPath, $temp); //生成文件