我們先來看一下php中的 file_get_contents()函數(shù)的語法
string file_get_contents(string $ filename,bool $ include_path = false,resource $ context,int $ offset = 0,int $ maxlen)
將文件內(nèi)容讀取為字符串
這個php示例將從文件中讀取內(nèi)容并存儲到字符串變量中。
?php $ content = file_get_contents(“input.txt”); echo $ content; ?>
將內(nèi)容從URL讀取到字符串
?php $content = file_get_contents("http://example.com"); echo $content; ?>
以上就是關(guān)于php中file_get_contents()函數(shù)的相關(guān)知識點,感謝大家的閱讀和對腳本之家的支持。
標(biāo)簽:寧夏 常州 武威 荊門 遂寧 徐州 吐魯番 遵義
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《php中file_get_contents()函數(shù)用法實例》,本文關(guān)鍵詞 php,中,file,get,contents,函數(shù),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。