ControllersRest.php
RestTestController
Restful 测试
选择路由器:
$config['server']['route_tool'] = '\PG\MSF\Rest\Route';
路由相关配置 eg:
$config['rest']['route']['rules'] = [
'POST rests' => 'rest/create',
'GET rests/<id:\d+>' => 'rest/view',
'GET rests/<action:\w+>' => 'rest/',
'GET rests' => 'rest/index',
'PUT,PATCH rests/<id:\d+>' => 'rest/update',
'DELETE rests/<id:\d+>' => 'rest/delete',
'OPTIONS rests' => 'rest/options',
'OPTIONS rests/<id:\d+>' => 'rest/options',
];
建议action:
[
update -> 更新资源,如:/users/
delete -> 删除资源,如:/users/
view -> 查看资源单条数据,如:/users/
index -> 查看资源列表数据(可分页),如:/users
options -> 查看资源所支持的HTTP动词,如:/users/ | /users
create -> 新建资源,如:/users
]
Classes
Rest |
Class RestController |