我們先來看一下php中的 file_get_contents()函數的語法
string file_get_contents(string $ filename,bool $ include_path = false,resource $ context,int $ offset = 0,int $ maxlen)
將文件內容讀取為字符串
這個php示例將從文件中讀取內容并存儲到字符串變量中。
<?php $ content = file_get_contents(“input.txt”); echo $ content; ?>
將內容從URL讀取到字符串
<?php $content = file_get_contents("http://example.com"); echo $content;?>
以上就是關于php中file_get_contents()函數的相關知識點,感謝大家的閱讀和對VeVb武林網的支持。
新聞熱點
疑難解答
圖片精選