mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 08:02:48 +08:00
response的returnData方法增加content-length设置 #90
This commit is contained in:
@@ -52,6 +52,7 @@ class Response
|
|||||||
$data = $handler . '(' . \org\Transform::jsonEncode($data) . ');';
|
$data = $handler . '(' . \org\Transform::jsonEncode($data) . ');';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
header('Content-Length:' . strlen($data));
|
||||||
if ($exit) {
|
if ($exit) {
|
||||||
exit($data);
|
exit($data);
|
||||||
} else {
|
} else {
|
||||||
@@ -88,12 +89,13 @@ class Response
|
|||||||
* @param mixed $wait 返回数据格式
|
* @param mixed $wait 返回数据格式
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function success($msg = '', $data = '', $url = '', $wait = 3){
|
public static function success($msg = '', $data = '', $url = '', $wait = 3)
|
||||||
|
{
|
||||||
$result = [
|
$result = [
|
||||||
'code' => 1,
|
'code' => 1,
|
||||||
'msg' => $msg,
|
'msg' => $msg,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
'url' => $url ? $url: $_SERVER["HTTP_REFERER"],
|
'url' => $url ? $url : $_SERVER["HTTP_REFERER"],
|
||||||
'wait' => $wait,
|
'wait' => $wait,
|
||||||
];
|
];
|
||||||
$type = IS_AJAX ? Config::get('default_ajax_return') : Config::get('default_return_type');
|
$type = IS_AJAX ? Config::get('default_ajax_return') : Config::get('default_return_type');
|
||||||
@@ -113,7 +115,8 @@ class Response
|
|||||||
* @param mixed $wait 返回数据格式
|
* @param mixed $wait 返回数据格式
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function error($msg = '', $data = '', $url = '', $wait = 3){
|
public static function error($msg = '', $data = '', $url = '', $wait = 3)
|
||||||
|
{
|
||||||
$result = [
|
$result = [
|
||||||
'code' => 0,
|
'code' => 0,
|
||||||
'msg' => $msg,
|
'msg' => $msg,
|
||||||
|
|||||||
Reference in New Issue
Block a user