public funciton a{
retunr json(['code'=>0,'msg'=>'ok']);
}
new $res = a;
1.如何取得a函數(shù)返回json數(shù)據(jù)的code,msg?
public function b(Request $request)
{
// 創(chuàng)建一個對象
$response = response();
// 設置cookie
$response->cookie('foo', 'value');
new $res = a;
// 設置要返回的數(shù)據(jù)
$response->withBody($res);
return $response;
}
2.$res的數(shù)據(jù)在ajax中無法解析出來?