<!DOCTYPE html>
这是代码。
我该如何解决?
在将代码与 Laravel 集成之前,我测试了 HTML/CSS/JavaScript。
最佳答案
确保您的 PHP 文件没有结束标记 (?>
)。他们可能会在您的 HTML 中添加空格。
欲了解更多信息,see the PHP docs :
If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script.
您可能还想看看这篇文章:Why would one omit the close tag?
关于php - Laravel 在 Doctype 之前显示一个空行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11728791/