php - Using yii2 to build restful api, yii\web\Response::$acceptParams is empty, can anyone help me?
黄舟
黄舟 2017-05-16 13:11:16
0
1
332

If a request is sent via Accept: application/json; version=v1,
After content negotiation, yii\web\Response::$acceptParams will contain the value ['version' = > 'v1'].
But it is empty after printing. What is the reason?

var_dump((new Response())->acceptParams);
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
洪涛
 var_dump(Yii::$app->response->acceptParams["sub-version"]);
就可以了,被手册误导了
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template