*/ class Api extends Controller { /** * 微信消息接口 * @return string * @throws \Exception */ public function index() { if (!extension_loaded('soap')) { throw new \Exception('Not support soap.'); } $handler = new WechatHandler(); $service = new \SoapServer(null, ['uri' => 'api', 'trace' => 0]); $service->setObject($handler); $service->handle(); } }