You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
<?php
|
|
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
|
|
use AlibabaCloud\Client\AlibabaCloud;
|
|
use AlibabaCloud\Client\Exception\ClientException;
|
|
use AlibabaCloud\Client\Exception\ServerException;
|
|
use Dcat\Admin\Controllers\AdminController;
|
|
|
|
class Test extends AdminController
|
|
{
|
|
public function sentSms()
|
|
{
|
|
AlibabaCloud::accessKeyClient('LTAI4GBjK1Ha8r8fvDdq9atk','ZbRGJT44SEE2GGGy29bPmBVY2e2D6l')
|
|
->regionId('cn-shenzhen')
|
|
->asDefaultClient();
|
|
|
|
try {
|
|
$result = AlibabaCloud::rpc()
|
|
->product('Dysmsapi')
|
|
->version('2020-09-4')
|
|
->action('SendSms')
|
|
->method('POST')
|
|
->host('dysmsapi.aliyuncs.com')
|
|
->options([
|
|
'query' => [
|
|
'RegionId' => "cn-shenzhen",
|
|
'PhoneNumbers' => "13481194554",
|
|
'SignName' => "懒族 ",
|
|
],
|
|
])
|
|
->request();
|
|
dd($result);
|
|
}catch (ClientException $e){
|
|
echo $e->getErrorMessage() . PHP_EOL;
|
|
}catch (ServerException $e){
|
|
echo $e->getErrorMessage() . PHP_EOL;
|
|
}
|
|
}
|
|
}
|