为什么 <br> 和 <hr> 标签在 PhpStorm 中不起作用


Why <br> and <hr> tag don't work in PhpStorm

<br><hr>标签在PhpStorm中不起作用,当我在PhpStorm中运行我的index.php文件时,使用以下代码:

<?php
$a=10;
echo "This is $a";
echo "'n";
echo 'This is $a';
echo "'n";
echo "<hr>";
echo "<br>";
print "This is $a";
?>

我在控制台中得到这个:

This is 10
This is $a
<hr><br>This is 10

为什么会这样?

PHPStorm 控制台显示您的确切输出。而且是准确的。

<hr><br>标记是 HTML。在控制台中,您将看到它们,就像这样。

当您在 Web 浏览器中加载页面时,这些 HTML 标记将显示为水平线和空行,如您所期望的那样。

有关 PHPStorm 为运行 PHP 代码提供的不同选项的更多信息,请参阅此处:

https://www.jetbrains.com/phpstorm/help/running-php-applications.html