PHP rewinddir()函数与示例
PHP rewinddir()函數 (PHP rewinddir() function)
rewinddir() function is used to rewind/reset the directory handle which is created by the opendir() function.
rewinddir()函數用于后退/重置由opendir()函數創建的目錄句柄。
Syntax:
句法:
rewinddir(dir_handle);Parameter(s):
參數:
dir_handle – it is an optional parameter which is used to specify the directory handle resource if we do not specify the directory handle resource – it assumes the last link opened with opendir() function.
dir_handle –是一個可選參數,如果我們未指定目錄句柄資源,則用于指定目錄句柄資源–假定使用opendir()函數打開的最后一個鏈接。
Return value:
返回值:
It returns nothing.
它什么也不返回。
Example: PHP code to demonstrate example of rewinddir() function
示例:PHP代碼演示rewinddir()函數的示例
<?php$path = "/home";//checking whether $path is a directory or not //then, opening the directory and reading its files if (is_dir($path)) {if ($dh = opendir($path)) {while (($file = readdir($dh)) !== false) {echo "File:" . $file . "<br/>";}//rewinding/reset the directory handlerewinddir();//reading the files againwhile (($file = readdir($dh)) !== false) {echo "File:" . $file . "<br/>";}//closing the directoryclosedir($dh);} } ?>Output
輸出量
File:. File:.. File:main.php File:. File:.. File:main.phpReference: PHP rewinddir() function
參考: PHP rewinddir()函數
翻譯自: https://www.includehelp.com/php/rewinddir-function-with-example.aspx
總結
以上是生活随笔為你收集整理的PHP rewinddir()函数与示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ldo regula_使用C中的Regu
- 下一篇: c语言1+2+3+4+5_C程序来计算系