php创建打开文件和文件夹简单实例
实例:
<?php $dir = 'logs/'; $file = $dir . 'log_' . date('Ymd') . '.txt'; if (!file_exists($dir)) { mkdir($dir); } if (!file_exists($file)) { //如果文件不存在(默认为当前目录下) $fs = fopen($file, 'w+'); } else { $fs = fopen($file, 'a+'); } fwrite($fs, 'asd'); fclose($fs); //关闭文件 ?>
转载请注明:半叶寒羽
» php创建文件及文件夹