![](/themes/images/default.png)
Hàm file_exists() trong PHP - PHP Function
Code file_put_contents('test.txt', 'this is a test'); if (file_exists('test.txt')) { echo "file tồn tại!"; }else{ echo "file không tồn tồn tại!"; }
![](/themes/images/default.png)
Hàm file_get_contents() trong PHP - PHP Function
Code file_put_contents('test.txt', 'this is a test'); //đọc toàn bộ file echo file_get_contents('test.txt'). "<br />"; //đọc từ vị trí số 5 và lây 4 kí tự echo file_get_contents('test.txt', null, null, 5, 4). "<br />"; //đọc từ cuối file và lây 4 kí tự echo ...
![](/themes/images/default.png)
Hàm file_put_contents() trong PHP - PHP Function
Code file_put_contents('test.txt', 'this is a test'); //đọc toàn bộ file echo file_get_contents('test.txt');
![](/themes/images/default.png)
Hàm file() trong PHP - PHP Function
Code $filename = 'index.php'; file_put_contents('test.txt', "This is a test. this is a example example. this is a newline." ); //đọc toàn bộ file $file = file('test.txt'); echo "<pre>"; print_r($file ); echo "</pre>";
![](/themes/images/default.png)
Hàm fileatime() trong PHP - PHP Function
Code file_put_contents('test.txt', 'this is something'); if (file_exists('test.txt')){ echo "test.txt được truy cập cuối cùng vào lúc: " . date("F d Y H:i:s.", fileatime("test.txt")); }
![](/themes/images/default.png)
Hàm filectime() trong PHP - PHP Function
Code $filename = 'test.txt'; if (file_exists($filename)) { echo "$filename được thay đổi lần cuối vào lúc: " . date("F d Y H:i:s.", filectime($filename)); }
![](/themes/images/default.png)
Hàm filegroup() trong PHP - PHP Function
Code $filename = 'index.php'; print_r(posix_getgrgid(filegroup($filename)));
![](/themes/images/default.png)
Hàm fileinode() trong PHP - PHP Function
Code $filename = 'index.php'; if (getmyinode() == fileinode($filename)) { echo 'You are checking the current file.'; }
![](/themes/images/default.png)
Hàm filemtime() trong PHP - PHP Function
Code $filename = 'test.txt'; file_put_contents($filename, 'this a test string'); echo "$filename được tạo vào lúc: " .date ("F d Y H:i:s.", time()). "<br />"; sleep(15); $handle = fopen($filename, 'r+w'); fwrite($handle, 'Zaidap.com.nettttt'); fclose($handle); if ...
![](/themes/images/default.png)
Hàm fileowner() trong PHP - PHP Function
Code $filename = 'index.php'; print_r(posix_getpwuid(fileowner($filename)));
![](/themes/images/default.png)
Hàm fileperms() trong PHP - PHP Function
Code echo substr(sprintf('%o', fileperms('example.txt')), -4);
![](/themes/images/default.png)
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.";
![](/themes/images/default.png)
Hàm filetype() trong PHP - PHP Function
Code echo filetype('test.txt') . "<br />"; echo filetype('./images/');
![](/themes/images/default.png)
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");
![](/themes/images/default.png)
Hàm fpassthru() trong PHP - PHP Function
Code file_put_contents('test.txt', 'Zaidap.com.net'); $fp = fopen('test.txt','rb'); fpassthru($fp);
![](/themes/images/default.png)
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 />";
![](/themes/images/default.png)
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 />";
![](/themes/images/default.png)
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);
![](/themes/images/default.png)
Hàm fseek() trong PHP - PHP Function
Code $fp = fopen('test.txt', 'r+'); echo ftell($fp) ." <br />"; fseek($fp, 5); echo ftell($fp);
![](/themes/images/default.png)
Hàm fstat() trong PHP - PHP Function
Code $fp = fopen('test.txt', 'r+'); echo "<pre>"; print_r(fstat($fp)); echo "</pre>";