【发布时间】:2012-12-21 04:25:16
【问题描述】:
我使用 phpdocumentor 为我的项目生成文档。它为我的功能生成了很好的文档,例如:
/**
* Hash generator
*
* Long description
*
* @param string $password Password
* @return string
*/
function generate_hash($password) {
global $PASSWORD_SALT;
return crypt($password, $PASSWORD_SALT);
}
但我还没有找到一种方法来记录 slim(php 框架)的映射:
/**
* Delete news
*
* Delete news by id
*
* @link /news/delete/:id
*
*/
$app->get('/news/delete/:id', function ($id) use ($app) {
$item = ORM::for_table('news')->find_one($id);
if ($item)
$item->delete();
$app->redirect('/');
})->conditions(array('id'=>'\d+'));
记录此类事情的正确方法是什么?
【问题讨论】:
-
API 使用不是 API 文档的一部分。您可以将代码包装在函数或方法中,然后返回结果。
标签: php routing documentation slim phpdoc