Hàm fileperms() trong PHP - PHP Function
Code echo substr(sprintf('%o', fileperms('example.txt')), -4);
Hàm filesize() trong PHP - PHP Function
Code $filename = 'test.txt'; $size = filesize($filename); echo "kích thước của file $filename là: ". $size . "byte.";
Hàm filetype() trong PHP - PHP Function
Code echo filetype('test.txt') . "<br />"; echo filetype('./images/');
Hàm fopen() trong PHP - PHP Function
Code $handle = fopen("test.txt", "r"); $handle = fopen("index.php", "wb"); $handle = fopen("https://www.google.com.vn", "r");
Hàm fpassthru() trong PHP - PHP Function
Code file_put_contents('test.txt', 'Zaidap.com.net'); $fp = fopen('test.txt','rb'); fpassthru($fp);
Hàm fwrite() trong PHP - PHP Function
Code file_put_contents('test.txt', 'Zaidap.com.net'); $fp = fopen('test.txt','r+'); echo file_get_contents('test.txt') ."<br />"; echo "số kí tự đã ghi là: " . fwrite($fp, "examples") ."<br />"; echo file_get_contents('test.txt') ."<br />";
Hàm fputs() trong PHP - PHP Function
Code file_put_contents('test.txt', 'Zaidap.com.net'); $fp = fopen('test.txt','r+'); echo file_get_contents('test.txt') ."<br />"; echo "số kí tự đã ghi là: " . fputs($fp, "examples") ."<br />"; echo file_get_contents('test.txt') ."<br />";
Hàm fread() trong PHP - PHP Function
Code file_put_contents('test.txt', 'Zaidap.com.net'); $filename = "test.txt"; $handle = fopen($filename, "r"); echo $contents = fread($handle, 8); fclose($handle);
Hàm fseek() trong PHP - PHP Function
Code $fp = fopen('test.txt', 'r+'); echo ftell($fp) ." <br />"; fseek($fp, 5); echo ftell($fp);
Hàm fstat() trong PHP - PHP Function
Code $fp = fopen('test.txt', 'r+'); echo "<pre>"; print_r(fstat($fp)); echo "</pre>";
Hàm ftell() trong PHP - PHP Function
Code $fp = fopen('test.txt', 'r+'); echo ftell($fp) ." <br />"; fseek($fp, 5); echo ftell($fp);
Hàm ftruncate() trong PHP - PHP Function
Code $filename = 'test.txt'; file_put_contents($filename, "this is a test"); $handle = fopen($filename, 'r+'); ftruncate($handle, 10); echo fread($handle, filesize($filename)); fclose($handle);
Hàm glob() trong PHP - PHP Function
Code foreach (glob("*.txt" ) as $filename) { echo "$filename size " . filesize($filename) . "<br />"; }
Hàm is_dir() trong PHP - PHP Function
Code function checkdir( $path){ if (is_dir($path)) { return $path . " là một thư mục <br />"; }else{ return $path . " không phải một thư mục <br />"; } } echo checkdir("test.txt"); echo checkdir("css"); echo checkdir("files"); echo checkdir("something");
Hàm is_executable() trong PHP - PHP Function
Code function checkexEcutable( $path){ if (is_executable($path)) { return $path . " có thể thực thi <br />"; }else{ return $path . " không thể thực thi <br />"; } } echo checkexEcutable("test.txt"); echo checkexEcutable("css"); echo checkexEcutable("files");
Hàm is_file() trong PHP - PHP Function
Code function checkFile( $path){ if (is_file($path)) { return $path . " là một tập tin <br />"; }else{ return $path . " không phải một tập tin <br />"; } } echo checkFile("test.txt"); echo checkFile("css"); echo checkFile("something.txt");
Hàm is_link() trong PHP - PHP Function
Code function checkLink( $path){ if (is_link($path)) { return $path . " là một link <br />"; }else{ return $path . " không phải một link <br />"; } } echo checkLink("test.txt"); echo checkLink("/css/"); echo checkLink("something");
Hàm is_readable() trong PHP - PHP Function
Code function checkReadable( $path){ if (is_readable($path)) { return $path . " có thể đọc <br />"; }else{ return $path . " không thể đọc <br />"; } } echo checkReadable("test.txt"); echo checkReadable("/css/"); echo checkReadable("something.txt");
Hàm is_uploaded_file() trong PHP - PHP Function
Code if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { echo "File ". $_FILES['userfile']['name'] ." uploaded successfully. "; echo "Displaying contents "; readfile($_FILES['userfile']['tmp_name']); } else { echo "Possible file upload attack: "; ...
Hàm is_writable() trong PHP - PHP Function
Code function checkWriteable( $path){ if (is_writable($path)) { return $path . " có thể ghi <br />"; }else{ return $path . " không thể ghi <br />"; } } echo checkWriteable("test.txt"); echo checkWriteable("/css/"); echo checkWriteable("something"); });







