Nessuna descrizione

sms_create_signature.php 861B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. require_once __DIR__ . '/../../autoload.php';
  3. use Qiniu\Auth;
  4. use Qiniu\Sms\Sms;
  5. // 控制台获取密钥:https://portal.qiniu.com/user/key
  6. $accessKey = getenv('QINIU_ACCESS_KEY');
  7. $secretKey = getenv('QINIU_SECRET_KEY');
  8. $auth = new Auth($accessKey, $secretKey);
  9. $client = new Sms($auth);
  10. // 创建签名
  11. // 参考文档:https://developer.qiniu.com/sms/api/5844/sms-api-create-signature
  12. // 签名审核标准:https://developer.qiniu.com/sms/manual/5816/signature-specification
  13. $signature = 'xxxx'; // 签名
  14. $source = 'website'; // 签名来源,申请签名时必须指定签名来源
  15. $pics = '../php-logo.png'; // 签名对应的资质证明图片
  16. list($ret, $err) = $client->createSignature($signature, $source, $pics);
  17. echo "\n====> create signature result: \n";
  18. if ($err !== null) {
  19. var_dump($err);
  20. } else {
  21. var_dump($ret);
  22. }