Page 295 - Computer Software Application TP - Volume 1
P. 295

COMPUTER SOFTWARE APPLICATION - CITS



           3  Save the program in C:\Apache24\htdocs in a folder with .php extension
           4  Run the Apache services from windows services

           5  Open the browser and type the following address
                                  http://localhost/foldername/
           6  Click the php file to run  and verify the output










           II  Reading characters using file function
              1  Open the text editor

              2.  Write the following codes
                           <html>
                           <body>
                         <?php

                                    $file=”example.txt”;
                       if(file_exists($file))
                       {
                              $content=file($file) or die(“Error file opening not possible “);
                              foreach( $content as $line)

                              {
                                     echo $line;
                              }
                       }
                       else

                       {
                              echo “ERROR: File does not exist.”;
                       }
           ?>
                  </body>

                          </html>
           3  Save the program in C:\Apache24\htdocs in a folder with .php extension
           4  Run the Apache services from windows services
           5  Open the browser and type the following address

                                  http://localhost/foldername/
           6  Click the php file to run  and verify the output









                                                           280
                                CITS : IT & ITES - Computer Software Application - Exercise 55
   290   291   292   293   294   295   296   297   298   299   300