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

藏色散人
Release: 2023-03-13 19:26:01
Original
3173 people have browsed it

php br does not wrap because the
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

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;;
 ?>
Copy after login

If the middle newline operator is changed to
, 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
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
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!

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