对,所以要点是你的代码;从你的描述中,我以为你读的是别人的代码来获得灵感。
你的woostripe。加载网关类的php文件在加载网关类之前退出:
// bail on constructor if gateway class isn\'t loaded!
if (!class_exists(\'WooStripe_Gateway\')) return;
// ...
// why are you attempting to load WooCommerce\'s classes? Don\'t!
include_once(dirname(plugin_basename(\'woocommerce.php\')) . \'classese/abstracts/abstract-wc-payment-gateway.php\');
// never gets here to load this class, you\'ve already left this function...
include_once(dirname(plugin_basename(__FILE__)) . \'classes/WooStripe_Gateway.php\');
删除WooCommerce类的include语句,这是WooCommerce的工作,而不是你的工作。然后将WooStripe\\u Gateway include移至
woocommerce_gateway_init()
before 测试以查看它是否存在。该类在加载之前不能存在。