Laravel 解析错误:语法错误,意外的 T_CLASS,期待 T_STRING
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34020272/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel parse error: syntax error, unexpected T_CLASS, expecting T_STRING
提问by Saani
I developed a laravel
application back in August
this year, and it was working fine then. I am trying to run that application now, and it returns this error:
我laravel
在August
今年开发了一个应用程序,当时它运行良好。我现在正在尝试运行该应用程序,它返回此错误:
parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '{' or '$' in D:\bkonme\artisan line 31
解析错误:语法错误,意外的 T_CLASS,在 D:\bkonme\artisan line 31 中需要 T_STRING 或 T_VARIABLE 或 '{' 或 '$'
And line 31 is like this:
第 31 行是这样的:
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
My PHP
version is 5.6.14
and I am using XAMPP
on windows
platform. I have some idea of it happening because of some version conflict between laravel
and PHP
, but i don't know how to resolve that issue, any help?
我的PHP
版本是5.6.14
,我使用XAMPP
的windows
平台。我有它,因为之间的一些版本冲突的发生了一些想法laravel
和PHP
,但我不知道如何解决这个问题,任何帮助吗?
采纳答案by álvaro González
Even if you have PHP/5.6.14 installed, your app is definitively not using it. You could not use class
as identifier until PHP/5.5 (demo).
即使您安装了 PHP/5.6.14,您的应用程序也绝对不会使用它。class
在 PHP/5.5 ( demo)之前,您不能用作标识符。
The feature is called Class name resolution via ::classand it's described in the Migrating from PHP 5.4.x to PHP 5.5.xchapter of the PHP manual.
该功能被称为通过:: Class类的名称解析和它在描述的迁移从PHP 5.4.x版本到PHP 5.5.XPHP手册的一章。