Home >Backend Development >PHP Tutorial >php程序换行,怎写?

php程序换行,怎写?

WBOY
WBOYOriginal
2016-06-23 14:23:161333browse

回复讨论(解决方案)

\r\n 

\r\n 

程序在浏览器,是换行!(图1)
为什么终端命令行,不是呢?(图2)


图1


图2

<?    $x=array(1 ,2 ,3);    echo $x[0];    echo "\r\n";    echo $x[1];    echo "\r\n";    echo $x[2];    echo "\r\n";?>


更改:
程序在终端命令行执行,是换行!(图2)

为什么在浏览器执行,不是换行,是个空格符?(图1)

\r\n 是文本换行

 才是 HTML 换行

\r\n 是文本换行

 才是 HTML 换行

php程序,怎写换行?
给个实例!

echo '123<br>';


    $x=array(1 ,2 ,3);
    echo $x[0];
    echo "
";
    echo $x[1];
    echo "
";
    echo $x[2];
    echo "
";
?>

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