PHP致命错误:类';Microsoft\BingAds\Auth\OAuthWebAuthCodeGrant';找不到
我正在尝试安装BingAds API,但我一直收到错误消息 PHP致命错误:未找到类“Microsoft\BingAds\Auth\OAuthWebAuthCodeGrant” 我检查了作曲器文件,看起来没问题PHP致命错误:类';Microsoft\BingAds\Auth\OAuthWebAuthCodeGrant';找不到,php,namespaces,bing,Php,Namespaces,Bing,我正在尝试安装BingAds API,但我一直收到错误消息 PHP致命错误:未找到类“Microsoft\BingAds\Auth\OAuthWebAuthCodeGrant” 我检查了作曲器文件,看起来没问题 { "name": "microsoft/bingads", "description": "This project provides a set of PHP client libraries that make it easy to access Bing Ads
{
"name": "microsoft/bingads",
"description": "This project provides a set of PHP client libraries that make it easy to access Bing Ads service APIs.",
"keywords": [ "php", "bingads", "bing ads", "sdk" ],
"license": "Apache-2.0",
"type": "library",
"homepage": "https://github.com/BingAds/BingAds-PHP-SDK",
"require": {
"php": ">=5.5.17",
"ext-curl": "*",
"ext-openssl": "*",
"ext-soap": "*"
},
"require-dev": {
"ext-curl": "*",
"ext-openssl": "*",
"ext-soap": "*"
},
"autoload": {
"psr-4": {
"Microsoft\\BingAds\\": "src/"
}
},
"authors": [
{
"name": "Microsoft",
"homepage": "https://github.com/BingAds/BingAds-PHP-SDK/graphs/contributors"
}
]
}
另外,OAuth2Callback.php文件看起来很好,我将标题上的名称空间称为use Microsoft\BingAds\Auth\OAuthWebAuthCodeGrant
之后,它在给出错误的行上调用类OAuthWebAuthCodeGrant()
文件结构如下所示:
- BingAds-PHP-SDK-master
- - OAuth2Callback.php
- - WebAuthHelper.php
- - composer.json
- - composer.lock
- - /samples
- - /src
- - /vendor
有人有什么线索吗?我不熟悉名称空间,不完全确定它是如何工作的。谢谢 您能分享更多关于OAuth2Callback.php的详细信息吗?你试过这个吗?如果您是在控制台中本地运行此功能,那么我建议从开始 最近,我从下载了V13源代码,因为指令中的“composer require microsoft/bingads”命令只向我发送V12而不是V13 我得到了相同的错误:PHP致命错误:未找到类“Microsoft\BingAds\Auth\OAuthWebAuthCodeGrant” 与composer.json相比 在V13中: “自动加载”:{ “psr-4”:{ “Microsoft\BingAds\”:“/src/” } }, 在v12中: “自动加载”:{ “psr-4”:{ “Microsoft\BingAds\”:“src/” } }, 将路径从“/src/”更新为“src/”后,运行“composer update”并正常工作