Skip navigation

Monthly Archives: Maret 2015


To accept Angular $http.post that is formatted as JSON in Yii2, just set this in the Yii2 application component.

        'request' => [
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
            ]
        ],

To use the data, don’t use global $_POST. Instead use

$data = Yii::$app->getRequest->post();
Iklan
%d blogger menyukai ini: