0

私はそのような要素を持つ連想配列を持っています (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 DB に保存します。DB では、次のように表示されます。

[{"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/は「文字列リテラルの制御文字が悪い」ためだと主張していますが、何が問題なのですか?

4

1 に答える 1