当我file_get_contents()在本地文件上使用函数时,结果包含 php 代码,但我只需要 HTML。
正在读取的文件内容:
<?php echo '<p>Hello</p>';?>
Run Code Online (Sandbox Code Playgroud)
从位于同一文件夹中的不同文件调用 file_get_contents 的结果:
<?php echo file_get_contents('test.php'); //returns the following: string(31) "Hello'; ?>"
Run Code Online (Sandbox Code Playgroud)
如果我从外部服务器读取文件,它会返回 HTML - 正如我所期望的。所以问题是:如何从本地文件中获取 HTML 输出?谢谢你们。