雅安论坛

标题: php 创建文件夹写入文件 [打印本页]

作者: 匿名    时间: 2021-8-13 14:23
标题: php 创建文件夹写入文件
  1. //创建文件夹
  2. $n = date('Y');
  3. $y = date('m');
  4. $r = date('d');
  5. $dir = $n .'/' . $y.'/' . $r . '/';
  6. $sj = date('Y-m-d-H-i-s');


  7. if (!file_exists($dir)){
  8.     mkdir ($dir,0777,true);
  9.      }
  10.    $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