PHP 写字符串到文件中
程序员文章站
2022-05-17 13:06:29
...
PHP 写字符串到文件中
<? function write_to_file($fn, $str) { if ($str == '') return 'Nothing to write...'; if ($fn == '') return 'No file to write to...'; if (($fp = @fopen($fn, 'w')) === false) return 'Error obtaining file handle'; if (@fwrite($fp, $str, strlen($str)) === false) { fclose($fp); return 'Error writing to file'; } fclose($fp); return 'Data written to file successfully'; } ?>
以上就是PHP 写字符串到文件中的内容,更多相关内容请关注PHP中文网(www.php.cn)!