Publish: 2018-11-08 | Modify: 2018-11-08
Example of reading a file:
<?php
$file = fopen("test.txt","r");
fread($file,filesize("test.txt"));
fclose($file);
?>
More information: PHP fread() function
Example:
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "Bill Gates\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
More information: PHP File Creation/Writing
file_put_contents('filename','filedata')
mkdir('filename','mode')
, default mode
is 0777
with maximum permissions.copy(source,destination)
rename(oldname,newname,context)
move_uploaded_file(file,newloc)
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.