简体   繁体   中英

How can i use PHP 8.1 syntax in VSCODE?

I have PHP 8.1.4 installed on my PC on a C drive

but I have XAMPP in drive D which have all my PHP files and I have PHP 8.1.2 in XAMPP

I have PHP Intelephense installed on my VSCODE and I disable PHP Language Features

but still when I write PHP 8 or 8.1 syntax my vscode show error

在此处输入图像描述

You have to specify your PHP version for the PHP intelephense extension.

2 ways to do that :

  • Settings > Preferences and typing "intelephense php version" and then yo can set 8.1.* instead 8.0.0 here :

  • edit your VSCODE settings.json with this : "intelephense.environment.phpVersion": "8.1.*" .

NB : check if you have the lastest version of PHP Intelephense it also very important!

And that's it !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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