PHP code example of huid / sms
1. Go to this page and download the library: Download huid/sms 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/ */
huid / sms example snippets
composer
// 使用模版方式
$message1 = new Message([
'template' => '{:date} is the good day',
'data' => [
'{:date}' => date('Y-m-d')
]
])
// 直接发送内容
$message => new Message([
'content' => 'this is a test message',
]);
$config = [
'gateway' => [
'qcloud' => [
'sdk_app_id' => 'xxxx',
'app_key' => 'xxxx',
'type' => 0
],
],
];
$sms = new Sms($config);
$sms->send(13800138000, $message1);
$sms->send(13800138000, $message2);