1
我試圖在我的預訂系統中實現Authorize.net自動循環計費(ARB)API,並在嘗試自動加載類時遇到錯誤。這是我無法運作的自定義自動加載功能:Authorize.net ARB自定義自動加載無法加載MerchantAuthenticationType類
function aim2_autoload($class) {
if (file_exists('../AIM-2.0/vendor/'.$class.'.php')) {
require '../AIM-2.0/vendor/'.$class.'.php';
}
if (file_exists('../AIM-2.0/vendor/authorizenet/authorizenet/lib/'.$class.'.php')) {
require '../AIM-2.0/vendor/authorizenet/authorizenet/lib/'.$class.'.php';
}
if (file_exists('../AIM-2.0/vendor/authorizenet/authorizenet/lib/shared/'.$class.'.php')) {
require '../AIM-2.0/vendor/authorizenet/authorizenet/lib/shared/'.$class.'.php';
}
if (file_exists('../AIM-2.0/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/'.$class.'.php')) {
require '../AIM-2.0/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/'.$class.'.php';
}
if (file_exists('../AIM-2.0/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/'.$class.'.php')) {
require '../AIM-2.0/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/'.$class.'.php';
}
}
spl_autoload_register('aim2_autoload');
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
不過,我發現了錯誤: Fatal error: Class 'net\authorize\api\contract\v1\MerchantAuthenticationType' not found in /home/user/example.com/cart/reservation/ajax-submit.php on line 122
。
我試過尋找在自動加載函數中使用兩個use
語句的替代方法,但什麼也沒找到。任何幫助,將不勝感激。