how to load a php file to just display the contents of the file, not executing it?
I want to see the contents on a web browser. But I can't find a way to load without it executing t开发者_StackOverflowhe contents.
thanks
If you want nice colouring, try highlight_file().
If you're programming in php in order to view a PHP file, simply load the file into a string, then run it through htmlentities before displaying it. It will escape all the html special characters and cause it to be displayed literally.
A combination of fopen
and fpassthru
should do the trick. Don't forget to send appropriate headers first. Alternatively readfile
.
If its just one large block, you could remove the tags..
otherwise, just rename the file to whatever.php.txt and load it in a browser..
精彩评论