How to save memory when reading a file in Php?

后端 未结 7 1089
悲哀的现实
悲哀的现实 2020-11-28 15:11

I have a 200kb file, what I use in multiple pages, but on each page I need only 1-2 lines of that file so how I can read only these lines what I need if I know the line numb

7条回答
  •  猫巷女王i
    2020-11-28 16:05

    Why are you only trying to load the first ten lines? Do you know that loading all those lines is in fact a problem?

    If you haven't measured, then you don't know that it's a problem. Don't waste your time optimizing for non-problems. Chances are that any performance change you'll have in not loading the entire 200K file will be imperceptible, unless you know for a fact that loading that file is indeed a bottleneck.

提交回复
热议问题