【问题标题】:Laravel Blade Template throws error "Unexpected end of the file"Laravel Blade 模板抛出错误“文件意外结束”
【发布时间】:2014-05-18 02:58:36
【问题描述】:

我从 Blade 上的 Laravel 收到以下错误:

syntax error, unexpected end of file, expecting variable (T_VARIABLE) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN)

这是我所做的。

我的控制器:

class AdminPostingController extends AdminBaseController
{
    protected $layout = "Admin.master";

    function postNew()
    {
        $this->layout->content = View::make("Admin.index");
    }
}

我的 Admin.index 文件:

@extends("Admin.master')

@section("content")
    <p>Example P</p>
@stop

这里是 Admin.master.blade.php:

@yield("content")

【问题讨论】:

  • 每个文件使用的文件名是什么,你的视图文件的路径是什么?

标签: php laravel blade


【解决方案1】:

您在 Admin.index 文件中有错字。

应该是@extends("Admin.master"),而不是@extends("Admin.master')。它应该可以解决问题。

编辑:如果我的原始答案不够清楚,问题是字符串开头有双引号,结尾有单引号,因此出现语法错误。

【讨论】:

  • Instead of @extends("Admin.master') it should be @extends("Admin.master"),你能解释一下区别吗?
猜你喜欢
  • 2013-04-13
  • 2016-03-07
  • 2012-02-10
  • 2013-09-10
  • 2017-05-17
  • 2018-06-14
  • 2021-09-04
  • 1970-01-01
相关资源
最近更新 更多