Home  >  Article  >  Backend Development  >  What should I do if php br does not wrap the line?

What should I do if php br does not wrap the line?

藏色散人
藏色散人Original
2021-11-10 10:12:173178browse

php br does not wrap because the 0c6dc11e160d3b678d68754cc175188a tag acts as a line break in the browser, but does not play a line break role in the source code; then you need to use the \nline break operation in the source code. Operate the source code.

What should I do if php br does not wrap the line?

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

php br Why not wrap the line? manage? ?

In the line wrapping operation of php, the difference between \n and 076402276aae5dbec7f672f8f4e5cc81

Blogger, I encountered a situation today, which is that in php The \n newline operator was written in the code, thinking that the output presented in the browser would be a newline, but unexpectedly it was not. The code and results are as follows:

<?php
 $name="haha";
 echo "hi,$name";
 echo "\n";
 echo &#39;hi,$name&#39;;
 ?>

If the middle newline operator is changed to 076402276aae5dbec7f672f8f4e5cc81, the result presented by the browser will be newline, as follows As shown in the picture:


Why does this result occur? Let's analyze it from the source code. Right-click on the Firefox browser to view the page source code. We will find that in the first case above, there will be branches in the source code, as shown in the figure:


In the second case above, there is no line break except for a 0c6dc11e160d3b678d68754cc175188a tag. The result is as shown in the figure:


##So we can draw a conclusion: in php, the \n newline operator operates on the source code and has no effect in the browser; and the 0c6dc11e160d3b678d68754cc175188a tag It functions as a line break in the compiler. This tag will appear in the source code, but it will not break in the source code.


Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of What should I do if php br does not wrap the line?. 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