本文整理汇总了PHP中DirectoryIterator::isReadable方法的典型用法代码示例。如果您正苦于以下问题:PHP DirectoryIterator::isReadable方法的具体用法?PHP DirectoryIterator::isReadable怎么用?PHP DirectoryIterator::isReadable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DirectoryIterator
的用法示例。
在下文中一共展示了DirectoryIterator::isReadable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPlugins
public function getPlugins()
{
$output = array();
$it = new DirectoryIterator(BASE . 'plugins/');
while ($it->valid()) {
$xml_path = $it->getPath() . $it->getFilename() . '/';
$xml_file = $xml_path . "plugin.xml";
if ($it->isReadable() && $it->isDir() && file_exists($xml_file)) {
$output[] = new PapyrinePlugin($xml_path);
}
$it->next();
}
return $output;
}
示例2: method1
protected function method1($dir, $padLength = 0)
{
$thisDir = new \DirectoryIterator($dir);
foreach ($thisDir as $value) {
if ($thisDir->isDot()) {
// Skip the dot directories
continue;
} else {
if ($thisDir->isDir()) {
if ($thisDir->isReadable()) {
// if this is a new directory AND we have permission to read it, recurse into it.
echo str_repeat(' ', $padLength * 2) . $value . "\\\n";
$this->method1($dir . '/' . $value, $padLength + 1);
}
} else {
// output the file
echo str_repeat(' ', $padLength * 2) . $value . "\n";
}
}
}
return;
}
示例3: exists
/**
* @param null $location
* @return bool
*/
public function exists($location = NULL)
{
if (!$location) {
$location = $this->location;
}
$di = new \DirectoryIterator($location);
return $di->isReadable();
}
示例4: dirIterator
/**
* Directory iterator
*
* @param string $fullpath - full path to the director we wish to iterate
* @return array - numerical index of returned pages
*/
private function dirIterator($fullpath)
{
$it = new DirectoryIterator($fullpath);
while ($it->valid()) {
if (!$it->isDot() && $it->isFile() && $it->isReadable() && substr($it->getFilename(), -4, 4) == '.php') {
$files[] = $it->getFilename();
}
$it->next();
}
return $files;
}
示例5: label
}
$home = $_SERVER['HOME'];
$account_user = $_SERVER['LOGNAME'];
$begin_script = time();
function label($text)
{
return "\n[" . date('r') . "] " . $text . "\n";
}
echo "#################################################\n";
echo "### Starting dreamhost account backup process ###\n";
echo "### " . date('r') . " ###\n";
echo "#################################################\n";
try {
// Check if we can read/write to mysql subdir chosen
$mysql_arquives = new DirectoryIterator($home . '/' . $backups_dir . '/' . $mysql_subdir);
if (!$mysql_arquives->isReadable() || !$mysql_arquives->isWritable()) {
throw new RuntimeException('No read or write access.');
}
} catch (RuntimeException $e) {
exit("Please make sure you provide a valid folder for the arquives, with read and write access.\n");
}
// Return an array with stdClass objects from API commands
function request_api($cmd)
{
$api_key = $_SERVER['argv'][1];
$xml = new SimpleXMLElement('https://api.dreamhost.com/?key=' . $api_key . '&cmd=' . $cmd . '&format=xml', null, true);
if ((string) $xml->result != 'success') {
exit("Request for '{$cmd}' unsuccessful.\n");
}
// Use json decode/encode to convert the SimpleXMLElement objects into stdClass objects
return json_decode(json_encode($xml->xpath('/dreamhost/data')));