Anonymous 发表于 2021-8-13 14:23: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);
页: [1]
查看完整版本: php 创建文件夹写入文件