【发布时间】:2014-07-29 23:55:47
【问题描述】:
我刚安装了 Laravel 4.2.7,开始编译刀片模板时遇到了一些问题。
所以Laravel在HomeController中自带了这个功能
public function showWelcome()
{
return View::make('hello');
}
我决定通过添加以下内容将一些变量添加到 hello 视图中:
public function showWelcome()
{
$data['test'] = 'hello world!';
return View::make('hello', $data);
}
并且...将文件名从hello.php 更改为hello.blade.php,因为我想打印出变量test。
一旦我刷新了 Laravel 附带的“你已经到达”页面的默认页面,它就会给我一个异常:
Symfony\Component\Debug\Exception\FatalErrorException thrown with message "Call to undefined function Illuminate\View\Compilers\token_get_all()"
Stacktrace:
#1 Symfony\Component\Debug\Exception\FatalErrorException in /Applications/AMPPS/www/weinternship/laravel/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php:118
#0 Illuminate\Exception\Handler:handleShutdown in <#unknown>:0
我使用过 Laravel 4.1.28,之前从未遇到过这个问题。我做错了什么?
编辑
在我的 hello.blade.php 内容中
我刚刚在 <div class="welcome'></div> 中插入了 {{$test}}
【问题讨论】:
-
将
hello.blade.php的内容添加到问题中 -
你运行的是什么版本的 PHP?
-
试过运行 PHP 5.4 和 5.5 还是不行