note 95751 deleted from function.fopen by cmb
| From: | cmb@php.net | Date: | Sun, 09 Feb 2020 08:14:07 +0000 |
| Subject: | note 95751 deleted from function.fopen by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214047@lists.php.net to get a copy of this message | ||
Note Submitter: Pastix
----
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.