我試圖使用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