【发布时间】:2014-09-14 12:52:51
【问题描述】:
当我在本地文件上使用file_get_contents() 函数时,结果包含 php 代码,尽管我只需要 HTML。
正在读取的文件内容:
<?php echo '<p>Hello</p>';?>
从位于同一文件夹中的不同文件调用 file_get_contents 的结果:
<?php echo file_get_contents('test.php'); //returns the following: string(31) "Hello'; ?>"
如果我从外部服务器读取文件,它会返回 HTML - 正如我所期望的那样。所以问题是:如何从本地文件中获取 HTML 输出?谢谢大家。
【问题讨论】:
标签: php file-get-contents