为什么我要在PHP中收到未定义的类型?
我正在使用 spomky labs的jwt framework库 v3.0 v3.0 for php for php创建 jwe tokens 。
我已经运行了作曲家需要Web-Token/JWT-Cryption
在我的PHP项目中安装库。这是我的composer.json
{
"require": {
"web-token/jwt-encryption": "^3.0",
"web-token/jwt-core": "^3.0"
}
}
开始导入不同的名称空间时 - 例如,加密算法命名空间:
<?php
require_once realpath("vendor/autoload.php");
use Jose\Component\Encryption\Algorithm\KeyEncryption\A256KW;
use Jose\Component\Encryption\Algorithm\ContentEncryption\A256CBCHS512;
?>
VSCODE PHP Intellisense不会显示任何错误。
但是,当我开始使用这些名称空间时,IntelliSense开始显示
未定义的类型'插入名称空间'
示例:
这是我的文件夹结构:
XAMPP/
├─ htdocs/
│ ├─ encryption_project/
│ │ ├─ index.php
│ │ ├─ composer.lock
│ │ ├─ composer.json
│ │ ├─ vendor/
│ │ │ ├─ autoload.php
│ │ │ ├─ web-token/
│ │ │ │ ├─ jwt-encryption/
│ │ │ │ ├─ jwt-core/
我使用XAMPP(Apache Web服务器)来运行我的PHP代码并在Vscode中进行编辑。
我的操作系统是Macos Monterey。我的PHP版本是8.1.6
I'm using Spomky Labs' JWT Framework Library v3.0 for PHP to create JWE Tokens.
I've ran composer require web-token/jwt-encryption
to install the library in my PHP project. Here's my composer.json
{
"require": {
"web-token/jwt-encryption": "^3.0",
"web-token/jwt-core": "^3.0"
}
}
When I start importing the different namespaces - for example the Encryption Algorithms namespace:
<?php
require_once realpath("vendor/autoload.php");
use Jose\Component\Encryption\Algorithm\KeyEncryption\A256KW;
use Jose\Component\Encryption\Algorithm\ContentEncryption\A256CBCHS512;
?>
VSCode PHP IntelliSense does not show any error.
But when I start using these namespaces, IntelliSense starts showing an error of
Undefined type 'insert namespace here'
Example:
Here is my folder structure:
XAMPP/
├─ htdocs/
│ ├─ encryption_project/
│ │ ├─ index.php
│ │ ├─ composer.lock
│ │ ├─ composer.json
│ │ ├─ vendor/
│ │ │ ├─ autoload.php
│ │ │ ├─ web-token/
│ │ │ │ ├─ jwt-encryption/
│ │ │ │ ├─ jwt-core/
I'm using XAMPP (Apache Web Server) to run my PHP code and editing in VSCode.
My OS is MacOS Monterey. My PHP version is 8.1.6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论