yii\helpers\Json - Yii2 类参考手册
Class yii\helpers\Json
| Inheritance | yii\helpers\Json » yii\helpers\BaseJson |
|---|---|
| Available since version | 2.0 |
Json is a helper class providing JSON data encoding and decoding.
It enhances the PHP built-in functions json_encode() and json_decode()
by supporting encoding JavaScript expressions and throwing exceptions when decoding fails.
Public Properties
隐藏继承的属性 Hide inherited properties
| 属性Property | 类型 Type | 简介 Description | 定义在 Defined By |
|---|---|---|---|
| $jsonErrorMessages | array | yii\helpers\BaseJson |
Public Methods
隐藏继承的方法 Hide inherited methods
| 方法 Method | 简介 Description | 定义在 Defined By |
|---|---|---|
| decode() | Decodes the given JSON string into a PHP data structure. | yii\helpers\BaseJson |
| encode() | Encodes the given value into a JSON string. | yii\helpers\BaseJson |
| errorSummary() | Generates a summary of the validation errors. | yii\helpers\BaseJson |
| htmlEncode() | Encodes the given value into a JSON string HTML-escaping entities so it is safe to be embedded in HTML code. | yii\helpers\BaseJson |
Protected Methods
隐藏继承的方法 Hide inherited methods
| 方法 Method | 简介 Description | 定义在 Defined By |
|---|---|---|
| handleJsonError() | Handles encode() and decode() errors by throwing exceptions with the respective error message. | yii\helpers\BaseJson |
| processData() | Pre-processes the data before sending it to json_encode(). |
yii\helpers\BaseJson |