💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
> 验证接口路由和设置跨域请求 ` ~~~ <?php // +---------------------------------------------------------------------- // | Created by PHPstorm: JRKAdmin框架 [ JRKAdmin ] // +---------------------------------------------------------------------- // | Copyright (c) 2019~2022 [LuckyHHY] All rights reserved. // +---------------------------------------------------------------------- // | SiteUrl: http://www.luckyhhy.cn // +---------------------------------------------------------------------- // | Author: LuckyHhy <jackhhy520@qq.com> // +---------------------------------------------------------------------- // | Date: 2020/3/12-11:46 // +---------------------------------------------------------------------- // | Description: // +---------------------------------------------------------------------- namespace app\api\check; use think\Controller; /** * Class ApiCheck * @package app\common\controller */ class ApiCheck extends Controller { protected function initialize() { parent::initialize(); // TODO: Change the autogenerated stub //设置跨域请求 header('content-type:application/json;charset=utf8'); header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Methods:GET,POST,PATCH,PUT,DELETE'); header('Authorization,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-Requested-With'); } /** * @return \think\response\Json * @author: LuckyHhy <jackhhy520@qq.com> * @date: 2020/3/12 * @name: miss * @describe: */ public function miss() { return json([ 'errno' => \ERRNO['PARAMERR'], 'msg' => '访问接口不存在或参数错误']); } } ~~~ `