标签: php
file_get_contents函数似乎无法从.php文件中读取PHP代码。它似乎忽略了<?php标记后的所有内容。
<?php
为什么会这样?
答案 0 :(得分:13)
我想这不是file_get_contents,而是打印内容的方式。将htmlspecialchars放入HTML文档时,使用{{3}}可以正确编码内容:
file_get_contents
htmlspecialchars
echo '<pre>', htmlspecialchars(file_get_contents('file')), '</pre>';