dongxing2263 2015-06-04 23:08
浏览 140
已采纳

Laravel Blade在<body>中渲染<head>内容

I need a little help here...

When I try to render a simple template in blade, I get a bad rendered html.

I have master.blade.php and home.blade.php inside views.admin directory.

<!-- master.blade.php -->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8"/>
  <title>Test Title</title>
</head>
<body>
  Content
</body>
</html>

<!-- home.blade.php -->
@extends('admin.master')

The rendered HTML when I call return view("admin.home"); looks like this:

<html lang="en">
<head></head>
<body>
<meta charset="utf-8">
<title>Test Title</title>
Content
</body></html>

Any ideas of what is happening?

Thanks.

  • 写回答

4条回答 默认 最新

  • dqbhdsec59405 2015-06-04 23:24
    关注

    Usually the case for the "&#65279;" character appearing is that it has been introduced by using a non UTF-8 encoded text editor or was introduced in a different way. My suggestion would be to use something like Sublime Text or Notepad++ to create fresh versions of each of these three documents. This usually happens because of a copy/paste without realizing it or using a text editor that has "extra formatting" that you cannot see (e.g. Word). The character is ZERO WIDTH NO-BREAK SPACE (you can see more information here). So, it's not a Laravel Blade issue, it's that extra whitespace-type characters are being introduced by whichever text editor you're using.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作