php - Laravel 在 Doctype 之前显示一个空行

标签 php html laravel

<!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/

相关文章:

php - 如何为使用 ExcelImport、存储库和模型的自定义命令编写 Laravel 测试

php - 模拟MySQL连接分析查询重建表结构(逆向工程表)

用于社交网络的 PHP 框架

php - 如何在 HTML 中换行没有空格的长行?

javascript - 如何使用 jQuery 将按钮的文本替换为列表项文本?

javascript - 图片加载时和加载后的尺寸不同

laravel - 如何在 Laravel MIX 上创建 svg Sprite ?

javascript - Git:如何在目录结构方面分离后端 Rest Api 和前端应用程序的版本控制?

php - float 无法连接

javascript - PHP读取DB值,JS递增,AJAX保存到DB,但为什么刷新页面之前默认为0.0?