ThinkPHP3.23 ali Big Fish Ali SMS ____php

Source: Internet
Author: User
Tags error code aliyun
Brief IntroductionAli Big Fish has been integrated into the Aliyun inside the Aliyun-products-SMS services


1.SDK and demo Download Click to open the link
2. After decompression, the Msg_demo and Msg_sdk folder deletion is placed under Thinkphp\library\vendor (Alidayu name is set by itself) 3. Will Thinkphp\library\vendor\alidayu\api_ demo\smsdemo.php Call Instance Delete 4.app\home\controller\sendsmscontroller.class.php Invocation instance
<?php
namespace Home\controller;

Require_once (vendor_path. ' alidayu/api_demo/smsdemo.php ');

Class sendsmscontroller{public

    function Send ($phone, $yzm) {
        //Invoke Sample

        header (' Content-type:text/plain; Charset=utf-8 ');
        
        $demo = new Smsdemo (
            "Youraccesskeyid",
            "Youraccesskeysecret"
        );
        
        echo "smsdemo::sendsms\n";
        $response = $demo->sendsms (
            "SMS Signature",//SMS signature
            "sms_0000001",//SMS Template number
            "12345678901",//SMS receiver
            Array (  ///SMS template in the field of the value
                "code" => "12345",
                "Product" => "DSD"
            )
        );
        Print_r ($response);

        if ($response->code = = ' OK ') {return
            true;
        } else{return
            false;}}


SMS signature and SMS template number to Aliyun application 5. Information sent successfully stdClass Object
(
[Message] => OK
[RequestID] => e830799e-d93b-417e-aa80-34e88a68b08b
[Bizid] => 393004808220517089^0
[Code] => OK
) 6. SMS Interface Call error code
Click to open the link


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.