开箱即用的Laravel 4语法错误 [英] Laravel 4 syntax error out-of-the-box

查看:68
本文介绍了开箱即用的Laravel 4语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了Laravel 4(Illuminate),并且在浏览器中打开index.php文件时,遇到了以下错误:

I just installed Laravel 4 (Illuminate) and as I opened the index.php file in a browser, I was met with this error:

解析错误:语法错误,意外的收益"(T_YIELD),/www/Laravel4/vendor/illuminate/view/src/Illuminate/View/Environment.php中第339行的预期标识符(T_STRING)

Parse error: syntax error, unexpected 'yield' (T_YIELD), expecting identifier (T_STRING) in /www/Laravel4/vendor/illuminate/view/src/Illuminate/View/Environment.php on line 339

我已经修复了meta文件夹的权限,并通过Composer安装了所有依赖项.我正在OSX 10.8.2上运行PHP版本5.5.0alpha2.

I have fixed the permissions for the meta folder, and installed all the dependencies through Composer. I am running PHP version 5.5.0alpha2 on OSX 10.8.2.

推荐答案

这是因为yield成为PHP 5.5中的语言构造(用于

That's because yield became a language construct in PHP 5.5 (used in Generators) - but someone decided that it's a good idea to use this short word to name a function:

public function yield($section)
{
  return isset($this->sections[$section]) ? $this->sections[$section] : '';
}

降级到PHP 5.4(毕竟,它是当前的主流版本,5.5甚至还不是beta版),并且应该可以正常工作.

Downgrade to PHP 5.4 (after all, it's the current mainstream version, 5.5 is not even in beta yet) and it should work fine.

这篇关于开箱即用的Laravel 4语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆