route->get('api/open/code1','gateway/api.card/add'); $version = request()->post('version'); //var_dump($version);die; if(!$version){ $version = request()->param('version'); } //默认跳转到v1版本 if ($version == null) $version = "api";#api.notify,url $pathInfo = request()->pathinfo(); if ($pathInfo == null) { $json = [ 'code' => -802, 'data'=>'', 'msg' =>'请求错误' ]; // var_dump($json); throw new HttpResponseException(json($json)); } if($version!='api'){ if(!str_contains($pathInfo, 'api.')){ app()->route->rule(':controller/:function', $version . '.:controller/:function'); } }else{ if(!str_contains($pathInfo, 'api.')){ app()->route->rule(':controller/:function', 'api' . '.:controller/:function'); } }