Use Alibaba big fish SMS to send verification code php code
Public function index () {$ client = new Client; $ request = new SmsNumSend; // SMS content parameter $ smsParams = ['code' => $ this-> randString (), 'product' => 'tested ']; // Set the request parameters. for details about the parameters, refer to the official documentation $ req = $ request-> setSmsTemplateCode ('SMS _ 1111 ') -> setRecNum ('20140901')-> setSmsParam (json_encode ($ smsParams)-> setSmsFreeSignName ('registration verification')-> setSmsType ('normal ') -> setExtend ('20140901'); print_r ($ client-> execute ($ req ));} /*** obtain the random digit number * @ param integer $ len length * @ return string */protected static function randString ($ len = 6) {$ chars = str_repeat ('20140901', $ len); $ chars = str_shuffle ($ chars); $ str = substr ($ chars, 0, $ len ); return $ str ;}