Home > Backend Development > PHP Tutorial > txt文件中包含空格、<br/>怎么原封不动的输出到网页中

txt文件中包含空格、<br/>怎么原封不动的输出到网页中

WBOY
Release: 2016-06-13 13:31:27
Original
1164 people have browsed it

txt文件中包含空格、
如何原封不动的输出到网页中

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><?php //*****<br/>*****
    if($a){
        echo "+";
    }else{
        echo "#";
    }
    //***** *****
?>
Copy after login

比如上面的文本存入一个a.txt文件中,格式和上面一样,那么php读取a.txt文件如何才能按它文件中一模一样的格式输出到网页中

------解决方案--------------------
echo file_get_contents('a.txt');
------解决方案--------------------
<?php <br />  <br>   //*****<br>*****<br>   if($a){<br>       echo "+";<br>   }else{<br>       echo "#";<br>   }<br>   //***** *****<br>?><br><br>
Copy after login

------解决方案--------------------
...
Copy after login

------解决方案--------------------
PHP code

<?php $text = <<<TXT
 //*****<br/>*****
    if($a){
        echo "+";
    }else{
        echo "#";
    }
    //***** *****
TXT;
echo htmlentities($text);

#页面效果
//*****<br>***** if(){ echo "+"; }else{ echo "#"; } //***** *****

#源码
 //*****<br/>*****
    if(){
        echo "+";
    }else{
        echo "#";
    }
    //***** *****
?> <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template