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"); });
Hàm link() trong PHP - PHP Function
Code $target = 'source.ext'; // This is the file that already exists $link = 'newfile.ext'; // This the filename that you want to link it to link($target, $link);
Hàm lstat() trong PHP - PHP Function
Code $filename = 'test.txt'; echo "<pre>"; print_r(lstat($filename)); echo "</pre>";
Hàm mkdir() trong PHP - PHP Function
Hàm mkdir() sẽ tạo mới thư mục theo đúng đường dẫn truyền vào. Cú pháp Cú pháp : mkdir( $filename, $mode, $recursive, $context); Trong đó : $filename là đường dẫn sẽ tạo thư mục. $mode là quyền của thư mục, mặc định là 0777. ...
Hàm move_uploaded_file() trong PHP - PHP Function
Code $uploads_dir = '/uploads'; foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; // basename() may prevent filesystem traversal attacks; // further ...
Hàm parse_ini_file() trong PHP - PHP Function
Code $arr = parse_ini_file('C:xamppphpphp.ini'); echo "<pre>"; print_r($arr); echo "</pre>";
Hàm parse_ini_string() trong PHP - PHP Function
Code //lấy về chuỗi ini $str = file_get_contents('C:xamppphpphp.ini'); $arr = parse_ini_string($str); echo "<pre>"; print_r($arr); echo "</pre>";
Hàm pathinfo() trong PHP - PHP Function
Code $path = 'C:xamppphpphp.ini'; $arr = pathinfo($path); echo "<pre>"; print_r($arr); echo "</pre>";
Hàm readfile() trong PHP - PHP Function
Code $path = 'test.txt'; file_put_contents('test.txt', 'this a test'); readfile($path);
Hàm readlink() trong PHP - PHP Function
Code // output e.g. /boot/vmlinux-2.4.20-xfs echo readlink('/vmlinuz');
Hàm realpath_cache_get() trong PHP - PHP Function
Code echo "<pre>"; print_r(realpath_cache_get()); echo "</pre>";