interface to ThinkPHP3.2. Novice graphic Teaching

Source: Internet
Author: User

Today, the next SMS messaging technology. Using a capacitive http://www.yuntongxun.com/

The usage is simple, the specific parameters to know are

Account SID App ID

AUTH Token App Token

AppID AppID Interface

Sendtemplatesms.php using interface files

CCPRestSDK.class.php Compatibility SDK Master file

With the above parameters, see the following steps:

1: First, you have to easily register an account, and open an application

I'm not going to make a presentation, I'll send you a diagram.

If you do not recharge first, there is a platform test number .

Create a template, this you test , you can first ignore this point , because he has a test template to provide you with

the contents of the template are as follows, and {1} {2} inside is invoked using the calling method , wondering what to look at .

Find the platform's SDK documentation and files

You will then see the following. Click the new User Guide ,

Download this

Inside can see many function template, we find the sendtempatesms.php of SMS

Found the OK. after they've all been found, , we analyze the sendtempatesms.php

The main configuration information, according to your application inside the three are in the inside

After the control has been completed

We'll pull down and we'll see a way.

The inside of the analysis is very full ,

Through this , we'll know.

Call this method , We need three functions

Cell phone number content data template ID

Pull it down again . we can see a logical processing , The inside is as follows

We can use this method to write our business logic , What happens after success , What happens after failure

You know that .

The following is the default success logic display

There are a lot of failures , He will have an error code , you can according to his error code to develop documents to find solutions to the solution ~

PS: If 110007 is wrong , You should keep an eye on your master configuration APPID there , There is a space that will show the wrong Oh

OK Now we'll start loading him into the TP frame .

Open thinkphp/vendor/ Create a folder phonesms put the file inside , the most important thing is the SDK ccprestsdk.php file ,

PS: now the class extension is added using the TP framework , so let 's rename the ccprestsdk.php to CCPRestSDK.class.php convenient to call when

We also remember the SMS template interface PHP file There is a way , Now we are in the framework of the public method file function inside the use of this functions

Copy that method in there.

Note : We're going to put the configuration information inside the method .

Let's start by customizing a method

Note Arrows , is the place where we form a method and modify

The following is the usual copy in, the success and failure logic can be modified by themselves

Now let's start debugging whether he's successful.

Create a method in the controller,

Explain $datas.

Is there a {1}{2}{3} in front of it?

Here is through $datas = Array (); Order of the form to use this {1}{2}{3}, please keep an eye out.

Ok. Now let's open this to debug. . whether it will succeed

Oh no My verification code today is more than the specified number of times . ~ it 's supposed to be too much testing. Ha , It's okay .

If we see this diagram, it means that the send was successful.

Ok. it worked.  .

interface to ThinkPHP3.2. Novice graphic Teaching

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.