PHP code example of weiwei / api-doc
1. Go to this page and download the library: Download weiwei/api-doc library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
weiwei / api-doc example snippets
namespace app\index\controller;
use think\Controller;
/**
* @title 测试demo
* @description 接口说明
* @group 接口分组
* @header name:key o接口
* @description 接口说明
* @author 开发者
* @url /index/demo
* @method GET
*
* @header name:device ct attribute1:对象属性1 attribute2:对象属性2
* @return array:数组值#
* @return list_user:用户列表@
* @list_user name:名称 mobile:手机号 list_follow:关注列表@
* @list_follow user_id:用户id name:名称
*/
public function index()
{
//接口代码
$device = $this->request->header('device');
echo json_encode(["code"=>200, "message"=>"success", "data"=>['device'=>$device]]);
}
/**
* @title 登录接口
* @description 接口说明
* @author 开发者
* @url /api/demo
* @method GET
* @module 用户模块
* @param name:name type:int