Getting data from MYSQL into JSON using PHP

后端 未结 5 517
挽巷
挽巷 2021-02-02 03:54

I have the following quite simple test PHP code that extracts the data and puts it into JSON formatted text.

I get the following error..

Fatal err

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-02 03:59

    You are probably encoding a very large dataset. You could encode each row, one row at a time instead of encoding it in one big operation.

    That way, each call to json_encode() only encodes a small array instead of a large one. The end result is the same. This is IMO the solution which will use the less memory.

提交回复
热议问题