Reading PHP code using file_get_contents
T开发者_如何学JAVAhe file_get_contents function doesn't seem to be able to read PHP code from .php files. It seems to ignore everything after a <?php
tag.
Why might be that?
I guess it isn’t file_get_contents
but the way you print the content. Use htmlspecialchars
to have the content encoded properly when putting it out into an HTML document:
echo '<pre>', htmlspecialchars(file_get_contents('file')), '</pre>';
精彩评论