雅安论坛
标题:
php 创建文件夹写入文件
[打印本页]
作者:
匿名
时间:
2021-8-13 14:23
标题:
php 创建文件夹写入文件
//创建文件夹
$n = date('Y');
$y = date('m');
$r = date('d');
$dir = $n .'/' . $y.'/' . $r . '/';
$sj = date('Y-m-d-H-i-s');
if (!file_exists($dir)){
mkdir ($dir,0777,true);
}
$myfile = fopen($dir.$sj.'.txt', "w") or die("Unable to open file!");
复制代码
for($i=0;$i<count($check_web);$i++){
$txt = "$check_web[$i]->".httpcode($check_web[$i]).'->'.date("H:i:s")."\n";
fwrite($myfile, $txt);
}
fclose($myfile);
欢迎光临 雅安论坛 (https://www.yaanbbs.net/)
Powered by Discuz! X3.4