Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn. I am completing the setup. If you want to use the text message verification function in the project, you will find the Ali big fish, the price seems to be the lowest at present. Everything else is easy to get. It is imported into the project. I don't know how to use it. I keep reporting errors. I checked it online. Most of them are the same as document cases. It's useless, there are also column examples in tp. It is estimated that they are both old and useless. Finally, let's record it here.
Download the SDK, decompress and introduce the Autoload. php, TopSdk. php, aliyun, and top folders.
The introduced location is APP_PATH/Common/Lib/Alidayu/. I think it is better not to move the tp file.
Create a new class file SendMSM. class. php based on your needs.
Format = "json"; $ c-> appkey = C ('alidayuappkey'); $ c-> secretKey = C ('alidayuappsecret'); $ req = new AlibabaAliqinFcSmsNumSendRequest; // $ req-> setExtend ("123456"); $ req-> setSmsType ("normal"); $ req-> setSmsFreeSignName ($ smsFreeSignName ); $ req-> setSmsParam ($ smsParam); $ req-> setRecNum ($ recNum); $ req-> setSmsTemplateCode ($ smsTemplateCode ); $ resp = $ c-> execute ($ req); return $ resp ;}}
I put the AppKey and secret in a separate configuration file, so that they can be modified in the background after being reset.
And then,
sendMSM(); } protected function sendMSM(){ $alidayu = new SendMSM(); $result = $alidayu->send('13000000000','{"code":"123456"}'); dump($result); }}
Test results:
object(stdClass)[11] public 'result' => object(stdClass)[12] public 'err_code' => string '0' (length=1) public 'model' => string '101550887105^1102084861016' (length=26) public 'success' => boolean true public 'request_id' => string '12cl9hupqvkgh' (length=13)