2
What tag do I use to display any code on the page? That is, how do I display codes PHP or any other on the page in such a way that the browser reads it as text and does not interpret it as code?
2
What tag do I use to display any code on the page? That is, how do I display codes PHP or any other on the page in such a way that the browser reads it as text and does not interpret it as code?
1
Have to use <
and >
(HTML Entities), something like:
<pre>
<?php
echo 'Olá';
<pre>
You can make it easier by using the function htmlspecialchars
of PHP itself, for example, assuming that it will read a script and display it:
<pre>
<?php
$dados = file_get_contents('script.php');
echo htmlspecialchars($dados);
?>
</pre>
Enjoy and read about some differences: What is the difference between htmlspecialchars() and htmlentities()?
0
I don’t know if I understand 100% but it seems that you are looking for something like the highlight_file function.
http://php.net/manual/en/function.highlight-file.php
Example of use: highlight_file('Myfile.php');
Browser other questions tagged php html5
You are not signed in. Login or sign up in order to post.