我试图使用PayPal自适应付款SDK的PHP版本,并且在include_paths和类未发现错误方面存在巨大困难。贝宝自适应付款SDK - 类'PayPal Core PPBaseService'找不到
我使用:
- Windows7
- Bitnami MediaWiki stack, v1.25.1-0
- PHP v5.5.25
- Apache v2.4.12
- PayPal AdaptivePaymentSdk 3.6.106
该SDK可在以下:
- https://github.com/paypal/adaptivepayments-sdk-php/tree/namespace-php5.3
我的文档根目录,因此被称为 '$ IP',就是:
- 'C:/Bitnami/mediawiki-1.25.1-0/apps/mediawiki/htdocs/'
SDK部署在文档根目录下,即
- $IP/adaptivepayments-sdk-php/...
我的include_path是绝望的行为,试图将所有可能的路径包含到所需的PHP文件中。换行增加了可读性:
include_path = ".;
C:\BitNami\mediawiki-1.25.1-0\php\PEAR;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\adaptivepayments-sdk-php\lib;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\adaptivepayments-sdk-php\lib\PayPal\Service;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\adaptivepayments-sdk-php\lib\PayPal\Types\AP;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\adaptivepayments-sdk-php\lib\PayPal\Types\Common;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\Auth;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\Auth\Oauth;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\Auth\Openid;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\Common;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\Core;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\Exception;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\Formatter;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\Handler;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\IPN;
C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\sdk-core-php\lib\PayPal\Transport
"
我收到错误:
Fatal error: Class 'PayPal\Core\PPBaseService' not found in C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\adaptivepayments-sdk-php\lib\PayPal\Service\AdaptivePaymentsService.php on line 27
请注意,类“贝宝\核心\ PPBaseService” 应该是通过一个或两个以下的include_path条目可达,上面列出:
- C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\adaptivepayments-sdk-php\lib;
- C:\Bitnami\mediawiki-1.25.1-0\apps\mediawiki\htdocs\adaptivepayments-sdk-php\vendor\paypal\adaptivepayments-sdk-php\lib\PayPal\Types\Common;
但我得到类未发现的错误。我在网上看到过几次这个问题,但没有提供工作解决方案。
无法找到“贝宝\核心\ PPBaseService”(这是ActivePaymentsService.php)类有多个版本:
- $IP/\vendor\paypal\adaptivepayments-sdk-php\lib\PayPal\Service\AdaptivePaymentsService.php
- $IP/adaptivepayments-sdk-php/lib/services/ActivePaymentsService.php
我指定我的“需要”语句日,但我不知道实际上知道应该使用哪个。我已经尝试过,并得到相同的错误。
的未找到类的PPBaseService驻留在 '$ IP \ adaptivepayments-SDK-PHP \供应商\贝宝\ SDK核心的PHP \ LIB \贝宝\核心\',具有指定命名空间:
namespace PayPal\Core;
.
.
class PPBaseService {
The class AdaptivePaymentsService also has a namespace specified:
namespace PayPal\Service;
.
.
use PayPal\Core\PPBaseService;
.
.
class AdaptivePaymentsService extends PPBaseService {
我对PHP名称空间或其含义或要求一无所知。特别是,我不明白是/为什么命名空间是相对于'$ IP/adaptivepayments-sdk-php/vendor/paypal/sdk-core-php/lib /'路径的。
更基本的是,我不知道为什么我的include_path没有捕获/覆盖SDK中的每个类!
我调用类是:
$IP/skins/Vector/VectorTemplate.php
在该文件的开头我注明:
- require("vendor/autoload.php");
- require_once("adaptivepayments-sdk-php/vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Service/AdaptivePaymentsService.php");
当这些语句执行,我得到的“类未找到”的错误。
我完全难住了。任何帮助将非常感激。
谢谢,
肖恩。
对于那些不熟悉的自适应支付SDK树:
.:
CHANGELOG.md
LICENSE.txt
README.md
composer.json
composer.lock
lib/
list.txt
samples/
vendor/
./lib:
services/
./lib/services:
AdaptivePayments/
./lib/services/AdaptivePayments:
AdaptivePayments.php
AdaptivePaymentsService.php
./samples:
CancelPreapproval.php
CancelPreapprovalReceipt.php
Common/
Configuration.php
ConfirmPreapproval.php
ConfirmPreapprovalReceipt.php
ConvertCurrency.php
ConvertCurrencyReceipt.php
ExecutePayment.php
ExecutePaymentReceipt.php
GetAllowedFundingSources.php
GetAllowedFundingSourcesReceipt.php
GetAvailableShippingAddresses.php
GetAvailableShippingAddressesReceipt.php
GetFundingPlans.php
GetFundingPlansReceipt.php
GetPaymentOptions.php
GetPaymentOptionsReceipt.php
GetShippingAddresses.php
GetShippingAddressesReceipt.php
GetUserLimits.php
GetUserLimitsReceipt.php
IPN/
PPBootStrap.php
Pay.php
PayReceipt.php
PaymentDetails.php
PaymentDetailsReceipt.php
Preapproval.php
PreapprovalDetails.php
PreapprovalDetailsReceipt.php
PreapprovalReceipt.php
Refund.php
RefundReceipt.php
SetPaymentOptions.php
SetPaymentOptionsReceipt.php
ShowAllResponse.php
SimpleSamples/
WebflowReturnPage.php
cert_key.pem
composer.json
index.php
install.php
./samples/Common:
Calls.php
Constants.php
Error.php
Response.php
jquery-1.3.2.min.js
jquery.qtip-1.0.0-rc3.min.js
jquery.qtip-1.0.0-rc3.min.txt
menu.html
sdk.css
sdk_functions.js
style.css
tooltip.js
./samples/IPN:
IPN-README.md
IPNListener.php
./samples/SimpleSamples:
ChainedPay.html.php
ChainedPay.php
DelayedChainedPay.html.php
DelayedChainedPay.php
EmbeddedPay.html.php
EmbeddedPay.php
ParallelPay.html.php
ParallelPay.php
Preapproval.html.php
Preapproval.php
SimplePay.html.php
SimplePay.php
./vendor:
autoload.php
composer/
paypal/
./vendor/composer:
ClassLoader.php
LICENSE
autoload_classmap.php
autoload_namespaces.php
autoload_psr4.php
autoload_real.php
installed.json
./vendor/paypal:
adaptivepayments-sdk-php/
sdk-core-php/
./vendor/paypal/adaptivepayments-sdk-php:
CHANGELOG.md
LICENSE.txt
README.md
composer.json
lib/
samples/
./vendor/paypal/adaptivepayments-sdk-php/lib:
PayPal/
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal:
Service/
Types/
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Service:
AdaptivePaymentsService.php
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Types:
AP/
Common/
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Types/AP:
Address.php
AddressList.php
CancelPreapprovalRequest.php
CancelPreapprovalResponse.php
ConfirmPreapprovalRequest.php
ConfirmPreapprovalResponse.php
ConversionRate.php
ConvertCurrencyRequest.php
ConvertCurrencyResponse.php
CurrencyCodeList.php
CurrencyConversion.php
CurrencyConversionList.php
CurrencyConversionTable.php
CurrencyList.php
DisplayOptions.php
ErrorList.php
ExecutePaymentRequest.php
ExecutePaymentResponse.php
FeeDisclosure.php
FundingConstraint.php
FundingPlan.php
FundingPlanCharge.php
FundingSource.php
FundingTypeInfo.php
FundingTypeList.php
GetAllowedFundingSourcesRequest.php
GetAllowedFundingSourcesResponse.php
GetAvailableShippingAddressesRequest.php
GetAvailableShippingAddressesResponse.php
GetFundingPlansRequest.php
GetFundingPlansResponse.php
GetPaymentOptionsRequest.php
GetPaymentOptionsResponse.php
GetPrePaymentDisclosureRequest.php
GetPrePaymentDisclosureResponse.php
GetShippingAddressesRequest.php
GetShippingAddressesResponse.php
GetUserLimitsRequest.php
GetUserLimitsResponse.php
InitiatingEntity.php
InstitutionCustomer.php
InvoiceData.php
InvoiceItem.php
PayError.php
PayErrorList.php
PayRequest.php
PayResponse.php
PaymentDetailsRequest.php
PaymentDetailsResponse.php
PaymentInfo.php
PaymentInfoList.php
PhoneNumber.php
PostPaymentDisclosure.php
PostPaymentDisclosureList.php
PreapprovalDetailsRequest.php
PreapprovalDetailsResponse.php
PreapprovalRequest.php
PreapprovalResponse.php
Receiver.php
ReceiverDisclosure.php
ReceiverDisclosureList.php
ReceiverIdentifier.php
ReceiverInfo.php
ReceiverInfoList.php
ReceiverList.php
ReceiverOptions.php
RefundInfo.php
RefundInfoList.php
RefundRequest.php
RefundResponse.php
SenderDisclosure.php
SenderIdentifier.php
SenderOptions.php
SetPaymentOptionsRequest.php
SetPaymentOptionsResponse.php
ShippingAddressInfo.php
TaxIdDetails.php
UserLimit.php
WarningData.php
WarningDataList.php
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Types/Common:
AccountIdentifier.php
BaseAddress.php
ClientDetailsType.php
CurrencyType.php
ErrorData.php
ErrorParameter.php
FaultMessage.php
PhoneNumberType.php
RequestEnvelope.php
ResponseEnvelope.php
./vendor/paypal/adaptivepayments-sdk-php/samples:
CancelPreapproval.php
CancelPreapprovalReceipt.php
Common/
Configuration.php
ConfirmPreapproval.php
ConfirmPreapprovalReceipt.php
ConvertCurrency.php
ConvertCurrencyReceipt.php
ExecutePayment.php
ExecutePaymentReceipt.php
GetAllowedFundingSources.php
GetAllowedFundingSourcesReceipt.php
GetAvailableShippingAddresses.php
GetAvailableShippingAddressesReceipt.php
GetFundingPlans.php
GetFundingPlansReceipt.php
GetPaymentOptions.php
GetPaymentOptionsReceipt.php
GetShippingAddresses.php
GetShippingAddressesReceipt.php
GetUserLimits.php
GetUserLimitsReceipt.php
IPN/
PPBootStrap.php
Pay.php
PayReceipt.php
PaymentDetails.php
PaymentDetailsReceipt.php
Preapproval.php
PreapprovalDetails.php
PreapprovalDetailsReceipt.php
PreapprovalReceipt.php
Refund.php
RefundReceipt.php
SetPaymentOptions.php
SetPaymentOptionsReceipt.php
ShowAllResponse.php
WebflowReturnPage.php
cert_key.pem
composer.json
index.php
./vendor/paypal/adaptivepayments-sdk-php/samples/Common:
Calls.php
Constants.php
Error.php
Response.php
jquery-1.3.2.min.js
jquery.qtip-1.0.0-rc3.min.js
jquery.qtip-1.0.0-rc3.min.txt
menu.html
sdk.css
sdk_functions.js
style.css
tooltip.js
./vendor/paypal/adaptivepayments-sdk-php/samples/IPN:
IPN-README.md
IPNListener.php
./vendor/paypal/sdk-core-php:
CHANGELOG.md
LICENSE.txt
README.md
build.xml
composer.json
lib/
tests/
./vendor/paypal/sdk-core-php/lib:
PayPal/
./vendor/paypal/sdk-core-php/lib/PayPal:
Auth/
Common/
Core/
Exception/
Formatter/
Handler/
IPN/
Transport/
./vendor/paypal/sdk-core-php/lib/PayPal/Auth:
IPPCredential.php
IPPThirdPartyAuthorization.php
Oauth/
Openid/
PPCertificateCredential.php
PPSignatureCredential.php
PPSubjectAuthorization.php
PPTokenAuthorization.php
./vendor/paypal/sdk-core-php/lib/PayPal/Auth/Oauth:
AuthSignature.php
MockOAuthDataStore.php
OAuthConsumer.php
OAuthDataStore.php
OAuthRequest.php
OAuthServer.php
OAuthSignatureMethod.php
OAuthSignatureMethodHmacSha1.php
OAuthSignatureMethodPLAINTEXT.php
OAuthSignatureMethodRsaSha1.php
OAuthToken.php
OAuthUtil.php
./vendor/paypal/sdk-core-php/lib/PayPal/Auth/Openid:
PPOpenIdAddress.php
PPOpenIdError.php
PPOpenIdSession.php
PPOpenIdTokeninfo.php
PPOpenIdUserinfo.php
./vendor/paypal/sdk-core-php/lib/PayPal/Common:
PPApiContext.php
PPArrayUtil.php
PPModel.php
PPReflectionUtil.php
PPUserAgent.php
./vendor/paypal/sdk-core-php/lib/PayPal/Core:
PPAPIService.php
PPBaseService.php
PPConfigManager.php
PPConnectionManager.php
PPConstants.php
PPCredentialManager.php
PPHttpConfig.php
PPHttpConnection.php
PPLoggingManager.php
PPMessage.php
PPRequest.php
PPUtils.php
PPXmlMessage.php
cacert.pem
./vendor/paypal/sdk-core-php/lib/PayPal/Exception:
OAuthException.php
PPConfigurationException.php
PPConnectionException.php
PPInvalidCredentialException.php
PPMissingCredentialException.php
PPTransformerException.php
./vendor/paypal/sdk-core-php/lib/PayPal/Formatter:
FormatterFactory.php
IPPFormatter.php
PPNVPFormatter.php
PPSOAPFormatter.php
./vendor/paypal/sdk-core-php/lib/PayPal/Handler:
IPPHandler.php
PPAuthenticationHandler.php
PPCertificateAuthHandler.php
PPGenericServiceHandler.php
PPMerchantServiceHandler.php
PPOpenIdHandler.php
PPPlatformServiceHandler.php
PPSignatureAuthHandler.php
./vendor/paypal/sdk-core-php/lib/PayPal/IPN:
PPIPNMessage.php
./vendor/paypal/sdk-core-php/lib/PayPal/Transport:
PPRestCall.php
./vendor/paypal/sdk-core-php/tests:
Openid/
PPAPIServiceTest.php
PPBaseServiceTest.php
PPBootStrap.php
PPCertificateCredentialTest.php
PPConfigManagerTest.php
PPConfigurationExceptionTest.php
PPConnectionExceptionTest.php
PPConnectionManagerTest.php
PPCredentialManagerTest.php
PPIPNMessageTest.php
PPInvalidCredentialExceptionTest.php
PPLoggingManagerTest.php
PPMessageTest.php
PPMissingCredentialExceptionTest.php
PPSignatureCredentialTest.php
PPUtilsTest.php
sdk_config.ini
./vendor/paypal/sdk-core-php/tests/Openid:
PPOpenIdAddressTest.php
PPOpenIdSessionTest.php
PPOpenIdTokeninfoTest.php
PPOpenIdUserinfoTest.php
谢谢。我拥有它 - 当使用composer安装adaptive-payments-sdk时,它也会安装Core库。 – sean