json_encode
(no version information, might be only in CVS)
json_encode -- Returns the JSON representation of a value
说明
string
json_encode ( mixed value )
Returns a string containing the JSON representation of
value
.
参数
value
The value
being encoded. Can be any type except
a resource.
This function only works with UTF-8 encoded data.
返回值
Returns a JSON encoded string on success.
范例
例 1. A json_encode() example
<?php $arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
echo json_encode($arr); ?>
|
上例将输出: {"a":1,"b":2,"c":3,"d":4,"e":5} |
|