encode() public static method
Encodes the given value into a JSON string.
The method enhances json_encode() by supporting JavaScript expressions. In particular, the method will not encode a JavaScript expression that is represented in terms of a yii\web\JsExpression object.
| public static string encode ( $value, $options = 320 ) | ||
|---|---|---|
| $value | mixed |
The data to be encoded. |
| $options | integer |
The encoding options. For more details please refer to http://www.php.net/manual/en/function.json-encode.php. Default is |
| return | string |
The encoding result. |
| throws | yii\base\InvalidParamException |
if there is any encoding error. |
Please login to continue.