/**
 * 写文件函数
 *
 * @param string $filename 文件名
 * @param string $text 要写入的文本字符串
 * @param string $openmod 文本写入模式('w':覆盖重写,'a':文本追加)
 * @return boolean
 */
function write_file($filename, $text, $openmod = 'w') {
	if (@$fp = fopen($filename, $openmod)) {
		flock($fp, 2);
		fwrite($fp, $text);
		fclose($fp);
		return true;
	} else {
		return false;
	}
}

 

 

延伸阅读:

PHP判断文件或者目录是否可写

相关文章:

  • 2021-10-29
  • 2022-12-23
  • 2021-12-31
  • 2021-07-07
  • 2021-07-04
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
相关资源
相似解决方案