时间:2021-07-01 10:21:17 帮助过:92人阅读
我们先来看一下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()函数的相关知识点,感谢大家的阅读和对脚本之家的支持。