简体   繁体   English

PHP Parse错误:语法错误,意外'?' - laravel

[英]PHP Parse error: syntax error, unexpected '?' - laravel

I'm using laravel 5.5 framework.It requirements PHP >= 7.0.0 . 我正在使用laravel 5.5 framework.It要求PHP >= 7.0.0 when I run server I got this error ( php artisan serve ): 当我运行服务器时我得到了这个错误( php artisan serve ):

PHP Parse error:  syntax error, unexpected '?' in E:\xampp\htdocs\dibit\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 233

I've installed the last version of xampp and phpstorm. 我已经安装了最新版本的xampp和phpstorm。

I think this error show I'm not using php 7. 我认为这个错误显示我没有使用php 7。

在此输入图像描述

in my console of my phpstorm when I run this commend: 当我运行这个推荐时,在我的phpstorm控制台中:

php -v

it returns PHP 5.6.21 . 它返回PHP 5.6.21

where is my problem? 我的问题在哪里?

the result of this code: 这段代码的结果:

<?php

echo phpversion();

?>

is: 是:

7.2.1



http://localhost/p.php

I have two xampp software but them have been installed an 我有两个xampp软件,但它们已经安装了

It looks to me like your command prompt uses an old php version. 它看起来像你的命令提示符使用旧的PHP版本。 To confirm that, run 要确认,请运行

where php

in a command prompt and find out whether it prints the right path (to PHP7). 在命令提示符下,找出它是否打印正确的路径(到PHP7)。 If it's incorrect, check the PATH environment variable and modify it with the correct path to PHP7. 如果不正确,请检查PATH环境变量并使用正确的PHP7路径进行修改。

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM