Answer the question
In order to leave comments, you need to log in
How to replace the file_put_contents function?
You need to replace the file_put_contents function with something else.
Now the function creates files and saves texts there,
I would like to replace a bunch of files with one so that the file becomes like a database and stores information in itself like a folder with files
$tank = "bd/".$text.".txt";
if (file_exists($tank)) {
} else {
file_put_contents($tank, $text = "<span class='$random'>$text</span><br>");
}
Answer the question
In order to leave comments, you need to log in
php.net/manual/ru/function.fopen.php
php.net/manual/ru/function.fwrite.php
php.net/manual/ru/function.fclose.php
This is the third time I've seen this code here, and I just can't ask the question, have you ever heard of negation in logical conditions?
So your code can be shortened and readability improved...
$tank = "bd/".$text.".txt";
if (!file_exists($tank)) {
file_put_contents($tank, $text = "<span class='$random'>$text</span><br>");
}
Try to look in this direction . Working with INI files in PHP , maybe this is what you need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question