I tried in the server folder to place a file with this content, the file file.txt does not open.

<?php if(file_exists('file.txt')){ $file = fopen('file.txt','r'); }else{ echo("Ошибка открытия файла: файл не существует"); } ?> 

Can I be deeply mistaken? A text editor window should appear in my views. If this is not the case, please explain how this works.

  • In your understanding of "open" is to launch a text editor and open a text file in it? - Andrey

2 answers 2

You are trying to open a file that is in the same folder as the executable script. Recheck the ways again.

    The text editor window will not appear. If you have a small file and you want to see its contents, you can use file_get_contents () .

    • Your answer is no different from the questioner option, except for using another function that performs the same thing. - VenZell