我有一个带有这样一个元素的关联数组(print_r($element) 的一部分):
[przeplywy] => Array
(
[0] => Array
(
[probes] => Array
(
[0] => sonda-10
)
[flow] => Array
(
[0] => Array
(
[0] => created
[1] => sip
[2] => sport
[3] => dip
[4] => dport
[5] => proto
[6] => sensor
[7] => os
)
[1] => Array
(
[0] => 2013-09-12 06:10:26
[1] => 192.168.0.1
[2] => 18560
[3] => 10.0.0.1
[4] => 1900
[5] => UDP
[6] => sonda-10
[7] =>
)
[2] => Array
(
[0] => 2013-09-12 09:31:08
[1] => 192.168.0.1
[2] => 13011
[3] => 10.0.0.1
[4] => 1900
[5] => UDP
[6] => sonda-10
[7] =>
)
[3] => Array
(
[0] => 2013-09-12 09:37:42
[1] => 192.168.0.1
[2] => 4813
[3] => 10.0.0.1
[4] => 1900
[5] => UDP
[6] => sonda-10
[7] =>
)
[4] => Array
(
[0] => 2013-09-12 11:24:41
[1] => 192.168.0.1
[2] => 50091
[3] => 10.0.0.1
[4] => 1900
[5] => UDP
[6] => sonda-10
[7] =>
)
[5] => Array
(
[0] => 2013-09-12 13:36:55
[1] => 192.168.0.1
[2] => 17064
[3] => 10.0.0.1
[4] => 1900
[5] => UDP
[6] => sonda-10
[7] =>
)
)
)
)
我正在使用 json_encode($t['przeplywy']); 将其作为长文本 utf8_general_ci 保存到 MySQL 数据库中。在数据库中,我可以将其视为:
[{"probes":["sonda-10"],"flow":[["created","sip","sport","dip","dport","proto","sensor","os"],["2013-09-12 06:10:26","192.168.0.1","18560","10.0.0.1","1900","UDP","sonda-10",""],["2013-09-12 09:31:08","192.168.0.1","13011","10.0.0.1","1900","UDP","sonda-10",""],["2013-09-12 09:37:42","192.168.0.1","4813","10.0.0.1","1900","UDP","sonda-10",""],["2013-09-12 11:24:41","192.168.0.1","50091","10.0.0.1","1900","UDP","sonda-10",""],["2013-09-12 13:36:55","192.168.0.1","17064","10.0.0.1","1900","UDP","sonda-10",""]]}]
当我尝试对其进行解码时,我得到 null 并且http://json.parser.online.fr/声称这是因为“字符串文字中的控制字符错误”出了什么问题?