public static function writeFile($filename, $content, $type = 1)
{
if ($type == 1) {
is_file($filename) && self::delFile($filename);
//删除文件
self::createFile($filename);
self::writeFile($filename, $content, 2);
return true;
} else {
if (!is_writable($filename)) {
return false;
}
$handle = fopen($filename, 'a');
if (!$handle) {
return false;
}
$result = fwrite($handle, $content);
if (!$result) {
return false;
}
fclose($handle);
return true;
}
}