我直接在src controller里面file_put_contents()
就会在根目录生成一个abc.txt的文件
---
如果只是一个文件的内容,那么放在本地文件夹下应该会更好一点,
---
As a general rule, databases are slower than files
--
If you want to load the full-content of a file to a PHP variable, the easiest (and, probably fastest) way would be file_get_contents
.
But, if you are working with big files, loading the whole file into memory might not be such a good idea : you'll probably end up with a memory_limit
error, as PHP will not allow your script to use more than (usually) a couple mega-bytes of memory.
So, even if it's not the fastest solution, reading the file line by line (fopen
+fgets
+fclose
), and working with those lines on the fly, without loading the whole file into memory, might be necessary...
---