JSON object max size?

前端 未结 4 1924
名媛妹妹
名媛妹妹 2020-12-15 21:35

Using jquery, I\'m able to send json objects from client to server using ajax like this:

var strJSON = \'{\"event\":[{
    \"dates\":[
        \"2009-10-14\"         


        
4条回答
  •  暖寄归人
    2020-12-15 22:16

    It seems like there is a size issue, when testing my Json string everything works when the string is small ,when I increment the string (php array to be encoded) the output of the Json string gets chopped off.

    when doing a string length on the failed string , I get (7796) . So I changed the max post option in the ini file both for the cli and apache to 64M instead of 8M and I am still getting the same problem. I do not think this problem is restricted to the apache LimitRequestBody since the php gives the same output on CLI.

    One more thing, when doing a var_dump on the encoded json string, I can see when it gets chopped of and the json tags do not get closed, hence why the Json decoder return a null.

    e.g

    $strJson = file_get_contents('http://mydomain/page');
    var_dump($strJson);
    

    You will see where the string is being chopped off and a zero is concatenated to end of the output.

提交回复
热议问题