note 95751 modified in function.fopen by thiago
| From: | thiago@php.net | Date: | Wed, 20 Jan 2010 11:26:56 +0000 |
| Subject: | note 95751 modified in function.fopen by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165130@lists.php.net to get a copy of this message | ||
If fopen() has been disabled for security reasons, is possible a porting FROM:
<?php
$f=fopen($file,'rb');
$data='';
while(!feof($f))
$data.=fread($f,$size);
fclose($f);
?>
TO:
<?php
$data = file_get_contents($file); // (PHP 4 >= 4.3.0, PHP 5)
?>
and also a porting FROM:
<?php
$f = fopen($file,'wb');
fwrite($f,$content,strlen($content));
fclose($f);
?>
TO:
<?php
$f=file_put_contents($file, $content); // (PHP 5)
?>
For detail read the php manual.
--was--
If fopen() has been disabled for security reasons, is possible a porting FROM:
$f=fopen($file,'rb');
$data='';
while(!feof($f))
$data.=fread($f,$size);
fclose($f);
TO:
$data = file_get_contents($file); // (PHP 4 >= 4.3.0, PHP 5)
and also a porting FROM:
$f = fopen($file,'wb');
fwrite($f,$content,strlen($content));
fclose($f);
TO:
$f=file_put_contents($file, $content); // (PHP 5)
For detail read the php manual.
http://php.net/manual/en/function.fopen.php