Use response () method call on Laravel json () returns the data unicode code conversion problem to solve

The default is returned json laravel unicode code, if the text can be seen directly, to add back -> setEncodingOptions (JSON_UNESCAPED_UNICODE) not to turn into a code unicode

 

return Response::json($data, $this->getStatusCode(), $header)->setEncodingOptions(JSON_UNESCAPED_UNICODE);

 

public  function Response () {
         // return json data 
        $ Data = [
             'errCode' => 0, 
            'errMsg An' => 'This is an error message', 
            'Data' => 'This is a data' 
        ]; 
        return Response () -> JSON ( $ Data ) -> setEncodingOptions (JSON_UNESCAPED_UNICODE); 
    }

 

 

 

Turn: https://blog.csdn.net/qq_36602939/article/details/87378765

 

Guess you like

Origin www.cnblogs.com/fps2tao/p/11355633.html