thinkphp5配置hg/apidoc接口文档
1 安装依赖
composer require hg/apidoc
composer require hg/apidoc:5.0.10 # 指定兼容TP5的版本:ml-citation{ref="2" data="citationList"}
2,在application/tags.php中添加服务提供者:
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------// 应用行为扩展定义文件
return [// 应用初始化'app_init' => ['hg\\apidoc\\providers\\ThinkPHP5Service',],// 应用开始'app_begin' => [],// 模块初始化'module_init' => [],// 操作开始执行'action_begin' => [],// 视图内容过滤'view_filter' => [],// 日志写入'log_write' => [],// 应用结束'app_end' => [],
];
添加前端apidoc文件
配置apidoc
接口使用
接口文档