×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

PHP example - How to write to a file using PHP?


PHP - How to write to a file using PHP?

You may take a look at the sample function below which does this.

<? 
  function WriteToFile($strFilename, $strText) 
{ 
      if($fp = @fopen($strFilename,"w ")) 
     { 
          $contents = fwrite($fp, $strText); 
          fclose($fp); 
          return true; 
      }
       else
      { 
          return false; 
      } 

  } 

  WriteToFile('path/File.txt','test 123'); 

  ?>

Category: PHP

 
<< Go back