2018-03-19 14:06:20 4081次浏览 1条回答 0 悬赏 20 金钱

Yii2 中 'application/json' => Response::FORMAT_JSONJSON_NUMERIC_CHECK
$behaviors['contentNegotiator'] 中配置 'application/json' => Response::FORMAT_JSON

如何让输出的内容有 JSON_NUMERIC_CHECK 属性
类似于 json_encode($assoc_array,JSON_NUMERIC_CHECK);

最佳答案

  • 小叮当的肚兜 发布于 2018-03-19 18:47 举报

    image.png

    //yii\web\JsonResponseFormatter 文件有注释
     'response' => [
         'formatters' => [
             \yii\web\Response::FORMAT_JSON => [
                  'class' => 'yii\web\JsonResponseFormatter',
                  'encodeOptions' => 32,
             ],
         ],
     ],
    
    没有找到数据。
您需要登录后才可以回答。登录 | 立即注册
acking
总监

acking 上海

注册时间:2012-05-16
最后登录:2天前
在线时长:65小时50分
  • 粉丝13
  • 金钱2565
  • 威望0
  • 积分3215

热门问题