What to do if php does not parse html tags

藏色散人
Release: 2023-03-11 12:54:01
Original
3025 people have browsed it

Solution to the problem that php does not parse html tags: 1. Use PHP to set the encoding "charset=utf-8"; 2. Use the meta tag to set "".

What to do if php does not parse html tags

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

What should I do if php does not parse the html tag?

php echo html content has been parsed, what is going on, as shown in Figure
What to do if php does not parse html tags

View code

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

After checking, it is affected by the code header('Content-Type: text/plain;charset=utf-8');.
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

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

2. Use meta tag

    <meta charset="UTF-8">
 <?php
        echo "helloword";    echo "<hr>";?>
Copy after login

What to do if php does not parse html tags

Recommended study: "PHP Video Tutorial"

The above is the detailed content of What to do if php does not parse html tags. For more information, please follow other related articles on the PHP Chinese website!

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