使用flc/dysms实现阿里云短信发送

一:文档地址

github:https://github.com/flc1125/dysms
composer:https://packagist.org/packages/flc/dysms

二:实现短信发送

 'LTAIbVA2LRQ1tULr',
    'accessKeySecret' => 'ocS48RUuyBPpQHsfoWokCuz8ZQbGxl',
];

$client  = new Client($config);
$sendSms = new SendSms;
$sendSms->setPhoneNumbers('发送手机号');
$sendSms->setSignName('短信签名');
$sendSms->setTemplateCode('短信模板CODE');
$sendSms->setTemplateParam('短信模板变量对应的实际值。支持传入多个参数,例:["code" => "123"]');
$sendSms->setOutId('外部流水扩展字段,无特殊要求忽略此字段');

print_r($client->execute($sendSms));

你可能感兴趣的:(短信阿里云)