⛔⛔⛔⛔⛔⛔⛔⛔⛔⛔
接口请求数组输出
Yii返回方式:
$response = Yii::$app->response;
$response->format = Response::FORMAT_JSON;
$response->data = $json;
return $response;
上述代码中,当$json当中包含ActiveRecord时,
如果Model重写了toArray方法,输出会自动执行toArray
⛔⛔⛔⛔⛔⛔⛔⛔⛔⛔
⛔⛔⛔⛔⛔⛔⛔⛔⛔⛔
Yii返回方式:
$response = Yii::$app->response;
$response->format = Response::FORMAT_JSON;
$response->data = $json;
return $response;
上述代码中,当$json当中包含ActiveRecord时,
如果Model重写了toArray方法,输出会自动执行toArray
⛔⛔⛔⛔⛔⛔⛔⛔⛔⛔