链街Dcat后台
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

  1. <?php
  2. namespace App\Admin\Controllers;
  3. use AlibabaCloud\Client\AlibabaCloud;
  4. use AlibabaCloud\Client\Exception\ClientException;
  5. use AlibabaCloud\Client\Exception\ServerException;
  6. use Dcat\Admin\Controllers\AdminController;
  7. class Test extends AdminController
  8. {
  9. public function sentSms()
  10. {
  11. AlibabaCloud::accessKeyClient('LTAI4GBjK1Ha8r8fvDdq9atk','ZbRGJT44SEE2GGGy29bPmBVY2e2D6l')
  12. ->regionId('cn-shenzhen')
  13. ->asDefaultClient();
  14. try {
  15. $result = AlibabaCloud::rpc()
  16. ->product('Dysmsapi')
  17. ->version('2020-09-4')
  18. ->action('SendSms')
  19. ->method('POST')
  20. ->host('dysmsapi.aliyuncs.com')
  21. ->options([
  22. 'query' => [
  23. 'RegionId' => "cn-shenzhen",
  24. 'PhoneNumbers' => "13481194554",
  25. 'SignName' => "懒族 ",
  26. ],
  27. ])
  28. ->request();
  29. dd($result);
  30. }catch (ClientException $e){
  31. echo $e->getErrorMessage() . PHP_EOL;
  32. }catch (ServerException $e){
  33. echo $e->getErrorMessage() . PHP_EOL;
  34. }
  35. }
  36. }