captcha = $captcha; $this->captchaConfig = $captchaConfig; } // 定义直接使用内容发送平台的内容 public function getContent(GatewayInterface $gateway = null) { return sprintf('您的验证码为:', $this->captcha); } // 定义使用模板发送方式平台所需要的模板 ID public function getTemplate(GatewayInterface $gateway = null) { return $this->captchaConfig['template_id']; } // 模板参数 public function getData(GatewayInterface $gateway = null) { $data = [ $this->captchaConfig['template_variable'] => $this->captcha ]; if (!empty($this->captchaConfig['project'])) { $data['project'] = $this->captchaConfig['project']; } return $data; } }