在laravel 5中创建新项目后出现奇怪的语法错误

时间:2018-02-10 16:44:16

标签: php laravel-5

我创建了一个新项目:laravel new myprojectname,我得到一个空白页面。首先,我认为是关于权限,所以我把777给了存储文件夹,但我仍然有空白页面。然后我检查了日志,我看到了:

    production.ERROR: Parse error: syntax error, unexpected '?', expecting 
variable (T_VARIABLE) {"exception":"[object] (Symfony\\Component\\Debug
\\Exception\\FatalThrowableError(code: 0): Parse error: syntax error, 
unexpected '?', expecting variable (T_VARIABLE) at /opt/lampp/htdocs
/myprojectname/vendor/symfony/routing/Route.php:53)  .....

我的php版本是:7.1.14。有谁知道为什么我得到这个?

谢谢

2 个答案:

答案 0 :(得分:2)

?行的53PHP 7.1中引入的新nullable types,您正在运行PHP 7.0.9,因此您需要`Intent ishintent = new Intent(this, Asynctasktomysql.class); pintent = PendingIntent.getService(this, 0, ishintent, 0); alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarm.cancel(pintent); alarm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 50000, pintent);` 得到错误。

答案 1 :(得分:0)

Laravel刚刚升级到5.6,它需要PHP 7.13。

此外,升级PHP后,请确保升级PHPUnit~7.0,fideloper / proxy~4.0和Symfony~4.0。

请点击此链接here获取完整升级详情。