mini-qrc.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // | 免责声明 ( https://thinkadmin.top/disclaimer )
  11. // +----------------------------------------------------------------------
  12. // | gitee 代码仓库:https://gitee.com/zoujingli/WeChatDeveloper
  13. // | github 代码仓库:https://github.com/zoujingli/WeChatDeveloper
  14. // +----------------------------------------------------------------------
  15. include '../include.php';
  16. // 小程序配置
  17. $config = [
  18. 'appid' => 'wx6bb7b70258da09c6',
  19. 'appsecret' => '78b7b8d65bd67b078babf951d4342b42',
  20. ];
  21. //We::config($config);
  22. // $mini = We::WeMiniQrcode($config);
  23. // $mini = new WeMini\Qrcode($config);
  24. $mini = \WeMini\Qrcode::instance($config);
  25. //echo '<pre>';
  26. try {
  27. header('Content-type:image/jpeg'); //输出的类型
  28. // echo $mini->createDefault('pages/index?query=1');
  29. // echo $mini->createMiniScene('432432', 'pages/index/index');
  30. echo $mini->createMiniPath('pages/index?query=1');
  31. } catch (Exception $e) {
  32. var_dump($e->getMessage());
  33. }