1 Star 0 Fork 26

逸_风/yii2-fast-api

forked from deepziyu/yii2-fast-api 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
api.config.php 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
deepziyu 提交于 2017-01-18 14:02 . add Api Document View
<?php
$config = [
'bootstrap' => [
[
'class' => 'yii\filters\ContentNegotiator',
'formats' => [
'application/json' => 'json',
'application/xml' => 'xml',
],
'languages' => [
'zh-CN',
'en',
],
]
],
'modules'=>[
'route'=>'deepziyu\yii\rest\module\RouteModule',
],
'components' => [
'errorHandler' => [
'class'=>'deepziyu\yii\rest\ErrorHandler'
],
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
//模块化的路径
"GET,POST,PUT,DELETE <module>/<controller:[\w-]+>/<action:[\w-]+>" => "<module>/<controller>/<action>",
//基本路径
"GET,POST,PUT,DELETE <controller:[\w-]+>/<action:[\w-]+>" => "<controller>/<action>",
],
],
'request' => [
'class' => '\yii\web\Request',
'enableCookieValidation' => false,
'parsers' => [
'application/json' => 'yii\web\JsonParser',
'text/json' => 'yii\web\JsonParser',
],
],
'response' => [
//返回异常统一处理
'on beforeSend' => function ($event) {
//$event->sender->format = 'json';
},
],
],
];
return $config;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/ztao/yii2-fast-api.git
git@gitee.com:ztao/yii2-fast-api.git
ztao
yii2-fast-api
yii2-fast-api
master

搜索帮助