search
Homephp教程php手册阿里大鱼API接口(短信接口)Thinkphp专版范例

阿里大鱼API接口(短信接口)Thinkphp专版范例

鉴于多数用户咨询Thinkphp使用方法,特此另外新增Thinkphp专版
原版地址:http://www.thinkphp.cn/code/1749.html

提供方官网:http://www.alidayu.com/

源码地址:
http://flc.ren/2016/02/452.html
https://code.csdn.net/flc1125/alidayu(原版)
https://code.csdn.net/flc1125/alidayu/tree/release/thinkphp(Thinkphp专版源码)

配置说明:
文件`/Application/Common/Conf/config.php`定义`AlidayuAppKey`和`AlidayuAppSecret`即可。获取,请参考官网!

使用说明:<?php <br /> /**<br>  * 阿里大鱼API接口(短信接口)Thinkphp专版范例<br>  *<br>  * @author Flc <br>  * @link http://flc.ren <br>  * @link https://code.csdn.net/flc1125/alidayu<br>  */<br> namespace Home\Controller;<br> <br> use Think\Controller;<br> use Alidayu\AlidayuClient as Client;<br> use Alidayu\Request\SmsNumSend;<br> <br> class IndexController extends Controller<br> {<br>     /**<br>      * 阿里大鱼demo<br>      * @return [type] [description]<br>      */<br>     public function index()<br>     {<br>         $client  = new Client;<br>         $request = new SmsNumSend;<br> <br>         // 短信内容参数<br>         $smsParams = [<br>             'code'    => $this->randString(),<br>             'product' => '测试的'<br>         ];<br> <br>         // 设置请求参数<br>         $req = $request->setSmsTemplateCode('SMS_5053601')<br>             ->setRecNum('13312341234')<br>             ->setSmsParam(json_encode($smsParams))<br>             ->setSmsFreeSignName('活动验证')<br>             ->setSmsType('normal')<br>             ->setExtend('demo');<br> <br>         print_r($client->execute($req));<br>     }<br> <br>     /**<br>      * 获取随机位数数字<br>      * @param  integer $len 长度<br>      * @return string       <br>      */<br>     protected static function randString($len = 6)<br>     {<br>         $chars = str_repeat('0123456789', $len);<br>         $chars = str_shuffle($chars);<br>         $str   = substr($chars, 0, $len);<br>         return $str;<br>     }<br> }<br> ?>其他说明:
目前仅开发短信相关功能,如需拓展,请在`/ThinkPHP/Library/Alidayu/Request/`目录下新增类,以开发更多功能接口!
开发文档参考网址:http://open.taobao.com/doc2/apiDetail.htm?spm=0.0.0.0.pjxLXY&apiId=25450

AD:真正免费,域名+虚机+企业邮箱=0元

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use