Scripts | Codes

All languages in three languages :-)
Showing posts with label fclose. Show all posts


Ajouter dans un fichier...

... no comments

Add into a file ...

... no comments

...يزيد في ملف

بدون تعلي

Open in a new window
<?
//#################################################
// find more codes on scripts-n-codes.blogspot.com
//#################################################
function add_to_file ($file, $data) {
 $fp = fopen($file, "a");
 fwrite($fp, $data);
 fclose($fp);
}
?>



Écrire dans un fichier...

... no comments

Writes into a file ...

... no comments

...يكتب في ملف

بدون تعلي

Open in a new window
<?
//#################################################
// find more codes on scripts-n-codes.blogspot.com
//#################################################
function write_to_file ($file, $data) { 
 $fp = fopen($file, "w");
 fwrite($fp, $data);
 fclose($fp);
}
?>



Lit un fichier...

... et retourne le résultat en une ligne.
Pour récupérer le fichier en son état original enlever rtrime().

Reads a file ...

... and returns the result in one line.
To retrieve the file in its original condition please remove rtrim().

...يقرأ ملف

و يرجع النتيجة في خط واحد 
  rtrime‎‎‎‎()  لإسترجاع الملف في حالته الأولى إزالة  

Open in a new window
<?
//#################################################
// find more codes on scripts-n-codes.blogspot.com
//#################################################
function read_from_file ($file) {
 $handle = @fopen($file, "r");
 $data = '';
 if ($handle) {
  while (!feof($handle)) {
   $buffer = fgets($handle, 4096);
   $data .= $buffer;
  }
  fclose($handle);
 }
 return rtrim($data);
}
?>

Subscribe to: Posts (Atom)
attendez....