contants有啥不一樣啊求大神簡單點?
fwrite寫入字符串
<?php
$file = fopen("test.txt","w");
echo fwrite($file,"Hello World. Testing!");
fclose($file);
?>
上面的代碼將輸出:
21file_put_contants寫入字符串
<?php
file_put_contants("test.txt","Hello World. Testing!");
?>
一句話,file_put_contants() 封裝了封裝了文件打開,關閉的過程.