サマリー:echo file_get_contents('text.txt'); // 直接獲取文件內(nèi)容strip_tags 去除html標(biāo)記echo strip_tags(file_get_contents('text.txt')); // 獲取去除html標(biāo)記的文件內(nèi)容echo file_get_contents('http://www.baidu.com'
echo file_get_contents('text.txt'); // 直接獲取文件內(nèi)容
strip_tags 去除html標(biāo)記
echo strip_tags(file_get_contents('text.txt')); // 獲取去除html標(biāo)記的文件內(nèi)容
echo file_get_contents('http://www.baidu.com'); // 獲取遠(yuǎn)程文件內(nèi)容
echo file_get_contents('123.jpg'); // 獲取圖片 注意:獲取圖片顯示時需要聲明頭部
echo file_get_contents('text3.csv'); // 獲取csv格式文件內(nèi)容
var_dump(file_put_contents('text4.txt','PHP中文網(wǎng)學(xué)PHP'));
$str = file_get_contents('text4.txt');
var_dump(file_put_contents('text4.txt',"$str.PHP中文網(wǎng)的老師都很好"));
添削の先生:韋小寶添削時間:2019-03-09 17:29:43
先生のまとめ:file_put_contents和file_get_contents這兩個函數(shù)是以后使用到差不多最多的 一定要好好去掌握哦 file_get_contents不僅僅可以獲取文件中的內(nèi)容