/**
* 写文件函数
*
* @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;
}
}
延伸阅读: