数据结构,是指API接口中,固定输出的数据内容,具体可以参考/restful/config.php
文件中的default
配置项。
也可以在调用时,通过\x\Restful::make('下标名')
方法,临时修改。
依赖类:\x\Restful
方法名:make()
参数:
string $type
default
返回值:\x\Restful
对象本身
示例代码:
namespace app\http;
use x\controller\Http;
/**
* @Controller(prefix="")
*/
class Index extends Http
{
/**
* @RequestMapping(route="/", method="get", title="主页")
*/
public function index() {
// 使用XML返回结构
// 使用自定义的数据结构下标
return \x\Restful::type('xml')->make('shop')->callback();
}
}
具体流程,可以参考配置说明章节。