Home> PHP Framework> ThinkPHP> body text

Example to explain how TP framework integrates Huawei Cloud SMS service

藏色散人
Release: 2022-11-18 21:04:04
forward
2001 people have browsed it

The followingthinkphpframework tutorial column will introduce to you how ThinkPHP integrates Huawei Cloud SMS Service. I hope it will be helpful to friends in need!

Example to explain how TP framework integrates Huawei Cloud SMS service

ThinkPHP integrates Huawei Cloud SMS service

This project integrates Huawei Cloud SMS sending service and supports ThinkPHP5.0 and ThinkPHP5. 1 and ThinkPHP6.0, maintained by Ningbo Shengjia Network Technology Co., Ltd.

Installation tutorial

Usecomposer require singka/singka-hwsmsto install from the command line. [Recommended learning: "thinkPHP Video Tutorial"]

Usage examples (based on ThinkPHP6.0)

 // +---------------------------------------------------------------------- namespace app\home\controller; use SingKa\HwSms\HwSms; class Index { /** * 短信发送示例 * * @url 华为云短信APP接入地址+接口访问URI * @appKey 华为云短信appKey * @appSecret 华为云短信appSecret * @sender 国内短信签名通道号或国际/港澳台短信通道号 * @signature 华为云短信签名 * @statusCallback 短信发送状态返回接收地址,可以为空 */ public function smsDemo() { $config['url'] = 'https://rtcsms.cn-north-1.myhuaweicloud.com:10743'; $config['appKey'] = 'PkT889B*************wM0GAi'; $config['appSecret'] = 'U58fd****************0o4N'; $config['sender'] = 'csms12345678'; $config['signature'] = '短信签名'; $config['statusCallback'] = '短信发送状态返回接收地址,可以为空'; $sms = new HwSms($config); $result = $sms->send('模板ID', '手机号码(多个号码可以用英文逗号隔开)', '短信变量数组'); if ($result['code'] == '000000') { echo '发送成功'; } else { echo $result['msg']; } } }
Copy after login

Other instructions

华为云短信介绍:https://support.huaweicloud.com/productdesc-msgsms/sms_desc.html
Copy after login

The above is the detailed content of Example to explain how TP framework integrates Huawei Cloud SMS service. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!