yc-open / chat-doc
ChatDoc
1.0.1
2023-08-09 07:51 UTC
Requires
- guzzlehttp/guzzle: ^7.7
- vlucas/phpdotenv: ^5.5
This package is auto-updated.
Last update: 2025-01-09 10:52:24 UTC
README
Composer安装
composer require yc-open/chat-doc
示例
<?php require_once __DIR__ . '/vendor/autoload.php'; try { $options=[ # 缓存驱动类,需要实现get、set、delete方法 # cache->get($key); # cache->set($key, $data, $expire = 0); # cache->delete($key); # 'cache'=>Cache::class, # 有写入权限的目录,用于存储access_token,优先使用cache,当二者都为空时手动处理 # 'runtime'=>'/runtime', # 项目KEY 'yc-project-key'=>'' ]; $data = Request::Auth($options)->access_token([ 'api_key'=>'', 'api_secret'=>'', ])->response(); print_r($data->access_token); } catch (ValidateException $e) { # 参数验证错误 } catch (HttpException $e) { # 服务器错误 } catch (HttpResponseException $e) { # 业务错误 } catch (\Throwable $th) { # 其他错误 }