php创建文件
//3.创建文件
$filename = $path."\\2.txt";
$pattern = "/[\/,\*,<>,\?\|]/";
if (!preg_match($pattern,$filename)) {
//判断同名文件是否存在
if (!file_exists($filename)) {
//touch($filename)创建文件
if (touch($filename)) {
print_r("创建成功");
}else{
print_r("创建失败");
}
}else{
print_r("文件已经存在,请重新命名");
}
}else{
print_r("非法文件名");
}
网站栏目:php创建文件
本文URL:http://www.scyingshan.cn/article/pdpood.html


咨询
建站咨询
