queryPubKey.php 825 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * The file is part of the payment lib.
  4. *
  5. * (c) Leo <dayugog@gmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. require_once __DIR__ . '/../../vendor/autoload.php';
  11. date_default_timezone_set('Asia/Shanghai');
  12. $cmbConfig = require_once __DIR__ . '/../cmbconfig.php';
  13. // 使用
  14. try {
  15. $client = new \Payment\Client(\Payment\Client::CMB, $cmbConfig);
  16. $res = $client->getPubKey();
  17. } catch (InvalidArgumentException $e) {
  18. echo $e->getMessage();
  19. exit;
  20. } catch (\Payment\Exceptions\GatewayException $e) {
  21. echo $e->getMessage();
  22. exit;
  23. } catch (\Payment\Exceptions\ClassNotFoundException $e) {
  24. echo $e->getMessage();
  25. exit;
  26. } catch (Exception $e) {
  27. echo $e->getMessage();
  28. exit;
  29. }
  30. var_dump($res);