php code view like a text?
Moderator: General Moderators
php code view like a text?
Hi all, how to post an php code or html code that can view like text?
Re: php code view like a text?
save a copy adding .txt to the end of the file.... myscript.php => myscript.php.txt
Or do you mean set it so that any .php in a certain directory (.ie and uploads directory where people can upload files) does not execute (I have seen sites get hacked this way).
If so, then add something like the following into an .htaccess file in that directory:
Be sure to add all variations that work on your server.... (.php, .php4, .php5, .phtml etc)
-Greg
Or do you mean set it so that any .php in a certain directory (.ie and uploads directory where people can upload files) does not execute (I have seen sites get hacked this way).
If so, then add something like the following into an .htaccess file in that directory:
Code: Select all
AddType text/plain .pl .cgi .php-Greg
Re: php code view like a text?
i mean is, i want to post a php code in a website, like a tutorial. when the visitor open the website he/she can see actually the code tutorial. like this website. http://www.w3schools.com/php/php_mail.asp
Re: php code view like a text?
All you have to do is use the correct entities (see http://www.w3schools.com/html/html_entities.asp) on the code and the either style a div to hold it, or wrap with <pre><tt> </tt></pre> to have ti be fixed width and keep all spacing.