Coder Social home page Coder Social logo

php_api_doc's Introduction

php_api_doc

效果图

配置

  • 将文件夹复制到到项目根目录即可。
  • 设置 api_doc/config/config.php 中 SYSTEM_CLASS_DIR 。
  • 赋予 api_doc/class 文件夹 777 权限。

方法注释

  • 事例一:
/**
* 批量获取用户基本信息
* @desc 用于获取多个用户基本信息
* @return int    code 操作码,0表示成功
* @return array  list 用户列表
* @return int    list[].id 用户ID
* @return string list[].name 用户名字
* @return string list[].note 用户来源
* @return string msg 提示信息
*/
public function getMultiBaseInfo()
{
    return [];
}
  • 事例二:
/**
 * 获取用户基本信息
 * @desc 用于获取单个用户基本信息
 * @return int    code 操作码,0表示成功, 1表示用户不存在
 * @return object info 用户信息对象
 * @return int    info.id 用户ID
 * @return string info.name 用户名字
 * @return string info.note 用户来源
 * @return string msg 提示信息
 */
public function getBaseInfo()
{
    return [];
}

传递参数注释

  • 在文件头部或底部配置每个方法的传入参数
/**
 * API_DOC 设置方法传参
 * @return array
 */
public function getRules()
{
    return [
        'getBaseInfo' => [
            'userId' => [
                'name'    => 'user_id',
                'type'    => 'int',
                'min'     => 1,
                'require' => true,
                'desc'    => '用户ID'
            ],
        ],

        'getMultiBaseInfo' => [
            'userIds' => [
                'name'    => 'user_ids',
                'type'    => 'array',
                'format'  => 'explode',
                'require' => true,
                'default' => '10',
                'range'   => [10,100],
                'desc'    => '用户ID,多个以逗号分割'
            ],
        ],
    ];
}

相关备注

  • 遇到问题可以关注公众号咨询。
  • 也可以加入QQ群:564557094。

微信名称:IT小圈儿,微信号:ToFeelings。

IT小圈儿

打赏

微信打赏

日志

  • 新增支持多级目录问题

php_api_doc's People

Contributors

xinliangcoder avatar

Watchers

James Cloos avatar Salde avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.