开发者

PHP json_encode unknown error

I am returning results from a MySql database in PHP that I would like to use the json_encode function to turn into a string to pass back for another page's usage to display options with开发者_如何学编程in a SELECT element. However, the json_encode method fails and my page is not rendering properly. By that I mean I receive a generic IIS error from the cgi-bin process. I have error capturing setup within my script but the error generated is not boiling up far enough to be shown and I am not sure why.

The basis of my question is how can I make json_encode like the information below or do I need to roll my own encoder to deal with it?

Array
(
    [0] => stdClass Object
        (
            [productID] => 2
            [optionID] => 1
        )

    [1] => stdClass Object
        (
            [productID] => 2
            [optionID] => 2
        )

    [2] => stdClass Object
        (
            [productID] => 2
            [optionID] => 3
        )

    [3] => stdClass Object
        (
            [productID] => 2
            [optionID] => 4
        )

)


Spell json_encode correctly and it works MUCH better... dummy me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜