PHP code example of cdcchen / yii2-alidayu

1. Go to this page and download the library: Download cdcchen/yii2-alidayu library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cdcchen / yii2-alidayu example snippets


'alidayu' => [
    'appKey' => 'xxx',
    'appSecret' => 'yyy',
],

/* @var \cdcchen\yii\alidayu\Client $client */
$client = Yii::$app->get('alidayu');
$response = $client->sendSms('手机号', '短信签名', '短信模板代码', '模板参数', '回传参数');
if ($response->isOK()) {
    // success data
    $data = $result->getData();
}
else {
    // error data
    $data = $result->getData();
}

/* @var \cdcchen\yii\alidayu\Client $client */
$client = Yii::$app->get('alidayu');
$response = $client->querySms('186xxxxxxxx', '日期', '当前页码', '每页条数', '流水号');
if ($response->isOK()) {
    // success data
    $data = $result->getData();
}
else {
    // error data
    $data = $result->getData();
}