Тёмный

PHP file_put_contents - Add and Update a Text File 

Very Academy
Подписаться 65 тыс.
Просмотров 20 тыс.
50% 1

In this tutorial we provide a basic example of php file_put_contents, file_get_contents and fopen to create and update a text file. We then update the text file with file_put_contents.

Хобби

Опубликовано:

 

22 апр 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 22   
@christianlanoire7541
@christianlanoire7541 2 года назад
Thank you!!, but where is the place to close the file? imagine we create and update many files, what would happen with the memory?
@youarelovedbylovehimself.6250
@youarelovedbylovehimself.6250 3 года назад
Thank you for taking your time to share your knowledge
@veryacademy
@veryacademy 3 года назад
My pleasure!
@villagerstown
@villagerstown 2 года назад
nice video but i have a question. in this video you overwrite the txt file. but i want to add more data in text file and dont want to delete existing data
@veryacademy
@veryacademy 2 года назад
stackoverflow.com/questions/103593/using-php-how-to-insert-text-without-overwriting-to-the-beginning-of-a-text-fil
@finnschnellenberg8374
@finnschnellenberg8374 Год назад
Good day. I looked at your tutorial and managed to do everything except for one small problem. I converted the textarea into an input field. That all worked out. however, I need 2 input options that both write in the log.txt. So far I haven't found a solution to this.
@veryacademy
@veryacademy Год назад
Hi Finn, really very easy when you know how. Maybe string concatenation is the direct that you need. stackoverflow.com/questions/24780677/file-put-contents-with-multiple-variables
@jonaspeters8648
@jonaspeters8648 Год назад
Thank you for the video. Do we need two php files for that, or is it possible in one php file?
@veryacademy
@veryacademy Год назад
Just one
@Henry_Nunez
@Henry_Nunez 2 года назад
Se puede hacer sin localhost ?? 👉 NO QUIERO USAR XAMPP
@davidholmes4439
@davidholmes4439 2 года назад
What program are you using to code?
@veryacademy
@veryacademy 2 года назад
Visual Studio Code
@saraaboshousha7266
@saraaboshousha7266 3 года назад
Thank you for this video! I have a question how do i have to store multiple inputs separated with a “ ,” . And i wanna store each user info on a separate line?
@veryacademy
@veryacademy 3 года назад
Hi Sara, sorry, not quite sure as to what you mean by store multiple inputs and store each user info on a separate line - store it where?
@saraaboshousha7266
@saraaboshousha7266 3 года назад
@@veryacademy i mean the user have to enter his name, family name, school name . The php should store these info separated by “ ,” in the txt file. And each line represents a different user and their info
@bronsondavion466
@bronsondavion466 2 года назад
i know Im kinda off topic but does anybody know a good site to watch newly released tv shows online?
@adrianleandro4315
@adrianleandro4315 2 года назад
@Bronson Davion Flixportal :)
@bronsondavion466
@bronsondavion466 2 года назад
@Adrian Leandro Thank you, I signed up and it seems to work :D I appreciate it!
@ATRcs22
@ATRcs22 3 года назад
My two cents for anyone interested: file_put_contents can accept a third parameter "flag". You can specify if you want the file to keep adding data instead of erasing it (like a log, a list, etc). In the example of this video, it will be something like this: file_put_contents($file, $comment, FILE_APPEND); For more info about file_put_contents() you can visit the php wiki and see the technical stuff as well as the examples.
@veryacademy
@veryacademy 3 года назад
Thanks Emanuel, I forgot about this tutorial!
@ATRcs22
@ATRcs22 3 года назад
@@veryacademy thanks to you man, your tutorial saved me. Cheers from Argentina
Далее
Smart Sigma Kid #funny #sigma #comedy
00:26
Просмотров 6 млн
PHP - Write to File -  file_put_contents()
15:37
Просмотров 5 тыс.
C vs C++
2:39
Просмотров 209 тыс.
PHP in 100 Seconds
2:21
Просмотров 1,3 млн
Top 10 CSS One Liners That Will Blow Your Mind
13:34
Просмотров 926 тыс.
Text file read using PHP
11:43
Просмотров 4,4 тыс.
Simple CRUD application with PHP and JSON
1:35:12
Просмотров 44 тыс.
One moment can change your life ✨🔄
0:32
Просмотров 33 млн
Отнимают ребенка ч.7
0:55
Просмотров 3,4 млн