首页 > 代码库 > PHP 写文件的例子

PHP 写文件的例子

$contents = "All the content"; $dir = ‘c:‘; $file_path = $dir . "\\content.txt"; if(is_writable($file_path)) {     file_put_contents($file_path , $contents); } else {     die("Directory $dir is not writable, or does not exist. Please check"); }

 

PHP 写文件的例子