时间:2021-07-01 10:21:17 帮助过:5人阅读
<?php
$filename = "html/cache.txt";
$contents = "我是张斌";
if(is_writable($filename)){
if(($handle = fopen($filename,"a") )== false){
echo "写入文件 $filename 失败";
exit();
}
if(fwrite($handle,$contents) == false){
echo "写入文件$filename失败";
exit();
}
echo "写入文件 $filename 成功";
fclose($handle);
}else{
echo "文件$filename不可写入";
}
?>
编程小节:注意中英文输入法的符号,特别是中文后的“;”!