框架中的 helpers.php 报语法错误

当我使用cli执行命令时报以下错误:

Parse error: parse error in /Users/hanzi/Project/Sense/api/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 480,

具体错误的行数是以下:

 return $factory->of($arguments[0], $arguments[1])->times($arguments[2]?? null); 报 ?? 这个运算符的错误。

我把$arguments[2]?? null 改为$arguments[2]? $arguments[2]:null,报错就不会在这一行,而是下一个有使用这个??运算符的地方。

但我的php版本已经是7.1.19,具体如下:

 PHP 7.1.19 (cli) (built: Jun 25 2018 10:43:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.19, Copyright (c) 1999-2018, by Zend Technologies
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 2

只安装了 一个php 么? 项目中跑一下phpinfo(); 看看是不是7+

5年前 评论

@PhoenixIcy 只装了一个php,phpinfo()也是7.1

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!