本文介绍了Laravel解析错误:语法错误,意外的T_CLASS,预期的T_STRING或T_VARIABLE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装laravel之后,我们会收到错误消息:

After installing laravel we get an error:

推荐答案

Laravel 5.1使用 ::class属性,以获取完全限定的类名的字符串表示形式.您看到的错误是由此行引起的

Laravel 5.1 uses the ::class property to get string representations of a fully qualified classname. The error you're seeing is caused by this line

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

PHP 5.5中引入了此语言功能,这是Laravel 5.1的要求.您安装的PHP版本可能早于5.5.尝试更新您的PHP二进制文件.

This language feature has been introduced in PHP 5.5 which is a requirement of Laravel 5.1. Your installed PHP version is probably older than 5.5. Try to update your PHP binary.

如果您对为什么使用::class感兴趣,请查看此答案

In case you are interested in why ::class is used, take a look at this answer

这篇关于Laravel解析错误:语法错误,意外的T_CLASS,预期的T_STRING或T_VARIABLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 14:01