php files

Solutions on MaxInterview for php files by the best coders in the world

showing results for - "php files"
Andres
08 Aug 2018
1<html>
2
3   <head>
4      <title>Reading a file using PHP</title>
5   </head>
6   
7   <body>
8      
9      <?php
10         $filename = "abc.txt";
11         $file = fopen( $filename, "r" );
12         
13         if( $file == false ) {
14            echo ( "Error in opening file" );
15            exit();
16         }
17         
18         $filesize = filesize( $filename );
19         $filetext = fread( $file, $filesize );
20         fclose( $file );
21         
22         echo ( "File size : $filesize bytes" );
23         echo ( "<pre>$filetext</pre>" );
24      ?>
25      
26   </body>
27</html>
28        //This is a php File Yes!!!!!
Soren
18 Apr 2020
1PHP files can contain text, HTML, CSS, JavaScript, and PHP code.
2PHP code is executed on the server, and the result is returned to the browser as plain HTML.
3PHP files have extension ".php