国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

print_r正常得到數(shù)據(jù),return json顯示空白

adminadmin

問題描述

這里詳細描述問題
print_r($response);//命令行正常得到數(shù)據(jù)
但是 使用return json($response);//則顯示空白

程序代碼

 $request_info = array(
            'table_name' => 'x_net_worth',
            'index_name' => 'x_net_worth_index',//多元索引名稱
            'search_query' => array(
                'offset' => 0,//本次查詢的開始位置。
                'limit' => 100,//本次查詢需要返回的最大數(shù)量。
                'get_total_count' => true,//是否返回匹配的總行數(shù),默認為false,表示不返回。返回匹配的總行數(shù)會影響查詢性能。
                'query' => array(
                    'query_type' => QueryTypeConst::MATCH_ALL_QUERY//設(shè)置查詢類型為QueryTypeConst::TERM_QUERY。
                ),
                'sort' => array(
                    array(
                        'field_sort' => array(
                            'field_name' => 'networth_timestamp',
                            'order' => SortOrderConst::SORT_ORDER_DESC
                        )
                    ),
                ),
                'token' => null,
            ),
            'columns_to_get' => array(
                'return_type' => ColumnReturnTypeConst::RETURN_ALL,
               // 'return_names' => array('networth_fund_code', 'networth_bonus_and_split')
            )
        );
        $response = $otsClient->search($request_info);

       print_r($response);//正常得到數(shù)據(jù)
       return json($response);//顯示空白

截圖

截圖

操作系統(tǒng)及workerman/webman等框架組件具體版本

webman'最新版本
windows下

1193 3 0
3個回答

法師

不是所有數(shù)據(jù)類型都支持json序列化

  • adminadmin 2023-01-20

    gettype出來的數(shù)據(jù)類型是array

walkor 打賞

根據(jù)手冊 https://www.php.net/manual/zh/function.json-encode
json數(shù)據(jù)必須是utf8編碼,否則可能返回false

浮舍

可以試試這個


class BaseController{

    protected function debug_printR( $content ) : Response {

        $res = "<pre>\n" . print_r( $content , true ) . "<br>\n" . "</pre>\n";

        return response( $res , 200 , [
            'Content-Type' => 'text/html' ,
        ] );
    }
}
年代過于久遠,無法發(fā)表回答
??