Qrcode.php 720 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: admin
  5. * Date: 2019/11/7
  6. * Time: 13:52
  7. */
  8. namespace wx\offiaccount;
  9. use wx\Base;
  10. class Qrcode extends Base
  11. {
  12. /**
  13. * 生成二维码
  14. * @param $token
  15. * @param $data
  16. * @return mixed|null
  17. */
  18. public function create($token, $data)
  19. {
  20. $url = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $token;
  21. $rs = $this->curl($url, $data);
  22. return $rs;
  23. }
  24. /**
  25. * 长连接转短链接
  26. */
  27. public function lang2short($token, $data)
  28. {
  29. $url = 'https://api.weixin.qq.com/cgi-bin/shorturl?access_token=' . $token;
  30. $rs = $this->curl($url, $data);
  31. return $rs;
  32. }
  33. }