Home > Backend Development > PHP Problem > php does not parse html code

php does not parse html code

藏色散人
Release: 2023-02-27 09:10:02
Original
4099 people have browsed it

php does not parse html code

php does not parse html code?

php echo html content is parsed, what is going on, as shown in the figure

php does not parse html code

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

After checking, it is because 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, while in plain form it will be output as it is on the page. Display this code

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;xxx&#39;>helloword</a>";
    echo "<hr>"; 
?>
Copy after login

2. Use meta tags

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

php does not parse html code

For more PHP related knowledge, please visit PHP Chinese website!

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

Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template