public function register_union($mobile) { $response = $this->unionpay->regByMobile($mobile); $response = json_decode($response, true); $respCd = $response['respCd']; if ($respCd == '000000') { return $response['data']; } else { return $respCd; } }
/** * * 用户注册-银联生成密码 */ function testRegByMobile() { header('Content-Type:text/html;charset=utf-8 '); $mobile = '13917368904'; $response = $this->unionpay->regByMobile($mobile); echo $response; $response = json_decode($response, true); $respCd = $response['respCd']; if ($respCd == '000000') { //success echo 'success'; } else { if ($respCd == 300102) { // 无效的手机 echo '无效的手机'; } else { if ($respCd == 300304) { // 已经注册 echo '已经注册'; } } } }