"."/> ".">

Home  >  Article  >  Backend Development  >  What should I do if the php output html code is not parsed?

What should I do if the php output html code is not parsed?

藏色散人
藏色散人Original
2021-09-25 14:28:083346browse

Solution to the problem that the html code output by php is not parsed: 1. Use PHP to set the encoding, code such as "header("Content-type:...charset=utf-8")"; 2. Use meta tags Set encoding, code such as "".

What should I do if the php output html code is not parsed?

The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer

What should I do if the html code output by php does not parse? ?

php echo html content was parsed, what happened, as shown in the figure

What should I do if the php output html code is not parsed?##

<p><?php<br/>    header(&#39;Content-Type:text/plain;charset=utf-8&#39;);    echo "helloword";    echo "<hr>";     <br/>?><br/></p>

After checking, it is because of header(' Content-Type: text/plain;charset=utf-8'); This sentence of code affects it.

Here we need to distinguish between text/html and text/plain: text/html is output in the form of html, for example, a text box will be displayed on the page, and in plain form, this paragraph will be displayed on the page as it is. Code

Then there are two ways to modify it

1. Use PHP to set the encoding

<p> <?php<br/>    header("Content-type: text/html; charset=utf-8");  <br/>    echo "<a href=&#39;http://s.jf3q.com&#39;>helloword</a>";    echo "<hr>"; <br/>?><br/></p>

2. Use meta tag

<p>    <meta charset="UTF-8"><br/> <?php<br/>        echo "helloword";    echo "<hr>";?><br/></p>

What should I do if the php output html code is not parsed?

Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of What should I do if the php output html code is not parsed?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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