store data into a text file using php?

前端 未结 6 1361
有刺的猬
有刺的猬 2021-01-13 14:46

i am trying to store data in a text file, something like an array into a text file using php instead of storing into mysql database.

for example here are the data to

6条回答
  •  我在风中等你
    2021-01-13 15:10

    I made a tiny library (~2 KB; <100 lines) that allows you to do just this: varDx

    It has functions to write, read, modify, check and delete data. It implements serialization, and therefore supports all data types.

    Here's how you can use it:

    def('file.dat'); //define data file
    
    $val1 = "this is a string";
    $dx->write('data1', $val1); //writes key to file
    echo $dx->read('data1'); //returns key value from file
    

提交回复
热议问题