我想寫一個文件字符的文件..指定文件,然後替換所有指定的類型...自己嘗試了很多遍,但是還是不行..不知道問題在哪..然後自己研究了discuz的寫入辦法.還是不行喔..高手可以分析一下錯處嗎..很短的一段...<?
$fp = fopen('abc.txt', 'r');
$configfile = fread($fp, filesize('abc.txt'));
fclose($fp); $configfile = preg_replace("old_", "new_';", $configfile);
$fp = fopen('abc.txt', 'w');
fwrite($fp, trim($configfile));
fclose($fp);
?>為什麼寫入後是空白呢>< 所有資料都消失了.
$fp = fopen('abc.txt', 'r');
$configfile = fread($fp, filesize('abc.txt'));
fclose($fp); $configfile = preg_replace("old_", "new_';", $configfile);
$fp = fopen('abc.txt', 'w');
fwrite($fp, trim($configfile));
fclose($fp);
?>為什麼寫入後是空白呢>< 所有資料都消失了.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货