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!"; }

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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 ...

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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');

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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>";

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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")); }

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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)); }

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm filegroup() trong PHP - PHP Function

Code $filename = 'index.php'; print_r(posix_getgrgid(filegroup($filename)));

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm fileinode() trong PHP - PHP Function

Code $filename = 'index.php'; if (getmyinode() == fileinode($filename)) { echo 'You are checking the current file.'; }

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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 ...

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm fileowner() trong PHP - PHP Function

Code $filename = 'index.php'; print_r(posix_getpwuid(fileowner($filename)));

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm fileperms() trong PHP - PHP Function

Code echo substr(sprintf('%o', fileperms('example.txt')), -4);

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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.";

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm filetype() trong PHP - PHP Function

Code echo filetype('test.txt') . "<br />"; echo filetype('./images/');

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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");

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm fpassthru() trong PHP - PHP Function

Code file_put_contents('test.txt', 'Zaidap.com.net'); $fp = fopen('test.txt','rb'); fpassthru($fp);

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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 />";

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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 />";

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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);

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm fseek() trong PHP - PHP Function

Code $fp = fopen('test.txt', 'r+'); echo ftell($fp) ." <br />"; fseek($fp, 5); echo ftell($fp);

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm fstat() trong PHP - PHP Function

Code $fp = fopen('test.txt', 'r+'); echo "<pre>"; print_r(fstat($fp)); echo "</pre>";

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021