• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_dir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中is_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP is_dir函数的具体用法?PHP is_dir怎么用?PHP is_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了is_dir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: command_dd

 function command_dd()
 {
     $args = func_get_args();
     $options = $this->get_options();
     $dd = kernel::single('dev_docbuilder_dd');
     if (empty($args)) {
         $dd->export();
     } else {
         foreach ($args as $app_id) {
             $dd->export_tables($app_id);
         }
     }
     if ($filename = $options['result-file']) {
         ob_start();
         $dd->output();
         $out = ob_get_contents();
         ob_end_clean();
         if (!is_dir(dirname($filename))) {
             throw new Exception('cannot find the ' . dirname($filename) . 'directory');
         } elseif (is_dir($filename)) {
             throw new Exception('the result-file path is a directory.');
         }
         file_put_contents($options['result-file'], $out);
         echo 'data dictionary doc export success.';
     } else {
         $dd->output();
     }
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:28,代码来源:doc.php


示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getArgument('path');
     if (!file_exists($path)) {
         $output->writeln("{$path} is not a file or a path");
     }
     $filePaths = [];
     if (is_file($path)) {
         $filePaths = [realpath($path)];
     } elseif (is_dir($path)) {
         $filePaths = array_diff(scandir($path), array('..', '.'));
     } else {
         $output->writeln("{$path} is not known.");
     }
     $generator = new StopwordGenerator($filePaths);
     if ($input->getArgument('type') === 'json') {
         echo json_encode($this->toArray($generator->getStopwords()), JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE);
         echo json_last_error_msg();
         die;
         $output->write(json_encode($this->toArray($generator->getStopwords())));
     } else {
         $stopwords = $generator->getStopwords();
         $stdout = fopen('php://stdout', 'w');
         echo 'token,freq' . PHP_EOL;
         foreach ($stopwords as $token => $freq) {
             fputcsv($stdout, [utf8_encode($token), $freq]) . PHP_EOL;
         }
         fclose($stdout);
     }
 }
开发者ID:yooper,项目名称:php-text-analysis,代码行数:30,代码来源:StopWordsCommand.php


示例3: save

 /**
  * Save an uploaded file to a new location.
  *
  * @param   mixed    name of $_FILE input or array of upload data
  * @param   string   new filename
  * @param   string   new directory
  * @param   integer  chmod mask
  * @return  string   full path to new file
  */
 public static function save($file, $filename = NULL, $directory = NULL, $chmod = 0755)
 {
     // Load file data from FILES if not passed as array
     $file = is_array($file) ? $file : $_FILES[$file];
     if ($filename === NULL) {
         // Use the default filename, with a timestamp pre-pended
         $filename = time() . $file['name'];
     }
     // Remove spaces from the filename
     $filename = preg_replace('/\\s+/', '_', $filename);
     if ($directory === NULL) {
         // Use the pre-configured upload directory
         $directory = WWW_ROOT . 'files/';
     }
     // Make sure the directory ends with a slash
     $directory = rtrim($directory, '/') . '/';
     if (!is_dir($directory)) {
         // Create the upload directory
         mkdir($directory, 0777, TRUE);
     }
     //if ( ! is_writable($directory))
     //throw new exception;
     if (is_uploaded_file($file['tmp_name']) and move_uploaded_file($file['tmp_name'], $filename = $directory . $filename)) {
         if ($chmod !== FALSE) {
             // Set permissions on filename
             chmod($filename, $chmod);
         }
         //$all_file_name = array(FILE_INFO => $filename);
         // Return new file path
         return $filename;
     }
     return FALSE;
 }
开发者ID:khaled-saiful-islam,项目名称:zen_v1.0,代码行数:42,代码来源:UploadComponent.php


示例4: initialize

 /**
  * Initializes this logger.
  *
  * Available options:
  *
  * - file:        The file path or a php wrapper to log messages
  *                You can use any support php wrapper. To write logs to the Apache error log, use php://stderr
  * - format:      The log line format (default to %time% %type% [%priority%] %message%%EOL%)
  * - time_format: The log time strftime format (default to %b %d %H:%M:%S)
  * - dir_mode:    The mode to use when creating a directory (default to 0777)
  * - file_mode:   The mode to use when creating a file (default to 0666)
  *
  * @param  sfEventDispatcher $dispatcher  A sfEventDispatcher instance
  * @param  array             $options     An array of options.
  *
  * @return Boolean      true, if initialization completes successfully, otherwise false.
  */
 public function initialize(sfEventDispatcher $dispatcher, $options = array())
 {
     if (!isset($options['file'])) {
         throw new sfConfigurationException('You must provide a "file" parameter for this logger.');
     }
     if (isset($options['format'])) {
         $this->format = $options['format'];
     }
     if (isset($options['time_format'])) {
         $this->timeFormat = $options['time_format'];
     }
     if (isset($options['type'])) {
         $this->type = $options['type'];
     }
     $dir = dirname($options['file']);
     if (!is_dir($dir)) {
         mkdir($dir, isset($options['dir_mode']) ? $options['dir_mode'] : 0777, true);
     }
     $fileExists = file_exists($options['file']);
     if (!is_writable($dir) || $fileExists && !is_writable($options['file'])) {
         throw new sfFileException(sprintf('Unable to open the log file "%s" for writing.', $options['file']));
     }
     $this->fp = fopen($options['file'], 'a');
     if (!$fileExists) {
         chmod($options['file'], isset($options['file_mode']) ? $options['file_mode'] : 0666);
     }
     return parent::initialize($dispatcher, $options);
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:45,代码来源:sfFileLogger.class.php


示例5: createPath

 protected function createPath()
 {
     $fullPath = dirname($this->fullFilePath());
     if (!is_dir($fullPath)) {
         mkdir($fullPath, 0755, true);
     }
 }
开发者ID:railsphp,项目名称:railsphp,代码行数:7,代码来源:NamedBase.php


示例6: initialize

 /**
  * Initialize the provider
  *
  * @return void
  */
 public function initialize()
 {
     $this->options = array_merge($this->defaultConfig, $this->options);
     date_default_timezone_set($this->options['log.timezone']);
     // Finally, create a formatter
     $formatter = new LineFormatter($this->options['log.outputformat'], $this->options['log.dateformat'], false);
     // Create a new directory
     $logPath = realpath($this->app->config('bono.base.path')) . '/' . $this->options['log.path'];
     if (!is_dir($logPath)) {
         mkdir($logPath, 0755);
     }
     // Create a handler
     $stream = new StreamHandler($logPath . '/' . date($this->options['log.fileformat']) . '.log');
     // Set our formatter
     $stream->setFormatter($formatter);
     // Create LogWriter
     $logger = new LogWriter(array('name' => $this->options['log.name'], 'handlers' => array($stream), 'processors' => array(new WebProcessor())));
     // Bind our logger to Bono Container
     $this->app->container->singleton('log', function ($c) {
         $log = new Log($c['logWriter']);
         $log->setEnabled($c['settings']['log.enabled']);
         $log->setLevel($c['settings']['log.level']);
         $env = $c['environment'];
         $env['slim.log'] = $log;
         return $log;
     });
     // Set the writer
     $this->app->config('log.writer', $logger);
 }
开发者ID:krisanalfa,项目名称:b-comp,代码行数:34,代码来源:LogProvider.php


示例7: __invoke

 public function __invoke($ctx)
 {
     if (isset($ctx['Directory']['path'])) {
         $path = $ctx['Directory']['path'];
     } else {
         $url = $ctx['env']['PATH_INFO'];
         if (strpos($url, '..') !== false) {
             return array(403, array('Content-Type', 'text/plain'), 'Forbidden');
         }
         $path = $this->path . $url;
     }
     // Sanity checks
     if (!file_exists($path)) {
         return array(404, array('Content-Type', 'text/plain'), 'File not found');
     }
     $path = realpath($path);
     if (false === $path) {
         // resolving failed. not enough rights for intermediate folder?
         return array(404, array('Content-Type', 'text/plain'), 'File not found');
     }
     if (strpos($path, $this->path) !== 0) {
         // gone out of "chroot"?
         return array(404, array('Content-Type', 'text/plain'), 'File not found');
     }
     if (!is_readable($path)) {
         return array(403, array('Content-Type', 'text/plain'), 'Forbidden');
     }
     // Only files are served
     if (is_dir($path)) {
         return array(403, array('Content-Type', 'text/plain'), 'Forbidden');
     }
     return $this->serve($path);
 }
开发者ID:LookForwardPersistence,项目名称:appserver-in-php,代码行数:33,代码来源:FileServe.php


示例8: checkSkinStyles

 /**
  *
  */
 public function checkSkinStyles($name, $values)
 {
     $config = Zend_Registry::get('config');
     $basePath = $config->design->pathToSkins;
     $xhtml = array();
     $this->view->name = $name;
     $this->view->selectedStyles = $values;
     //load the skin folders
     if (is_dir('./' . $basePath)) {
         $folders = Digitalus_Filesystem_Dir::getDirectories('./' . $basePath);
         if (count($folders) > 0) {
             foreach ($folders as $folder) {
                 $this->view->skin = $folder;
                 $styles = Digitalus_Filesystem_File::getFilesByType('./' . $basePath . '/' . $folder . '/styles', 'css');
                 if (is_array($styles)) {
                     foreach ($styles as $style) {
                         //add each style sheet to the hash
                         // key = path / value = filename
                         $hashStyles[$style] = $style;
                     }
                     $this->view->styles = $hashStyles;
                     $xhtml[] = $this->view->render($this->partialFile);
                     unset($hashStyles);
                 }
             }
         }
     } else {
         throw new Zend_Acl_Exception('Unable to locate skin folder');
     }
     return implode(null, $xhtml);
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:34,代码来源:CheckSkinStyles.php


示例9: bootstrap

 protected function bootstrap()
 {
     if (is_file('package.json')) {
         $this->comment(' -> Installing npm dependencies (with yarn)...');
         $this->executeCommand($this->input->getOption('sudo') ? 'sudo yarn' : 'yarn');
     }
     if (is_file('bower.json')) {
         $this->comment(' -> Installing bower dependencies...');
         $this->executeCommand('bower install');
     }
     if (is_file('composer.json')) {
         $this->comment(' -> Installing composer dependencies...');
         $this->executeCommand('composer install');
     }
     if (is_dir('storage')) {
         $this->comment(' -> Dando permissão de escrita no diretório storage...');
         $this->executeCommand('chmod -R 777 storage');
     }
     if (is_dir('app/storage')) {
         $this->comment(' -> Dando permissão de escrita no diretório storage...');
         $this->executeCommand('chmod -R 777 app/storage');
     }
     if (is_file('.env.example')) {
         $this->comment(' -> Criando o arquivo .env');
         $this->executeCommand('cp .env.example .env');
     }
 }
开发者ID:escapework,项目名称:console,代码行数:27,代码来源:CloneCommand.php


示例10: __construct

 function __construct(array $config = array())
 {
     $this->_config =& $config;
     // Try to locate app folder.
     if (!isset($config['app_dir'])) {
         $cwd = getcwd();
         while (!is_dir("{$cwd}/app")) {
             if ($cwd == dirname($cwd)) {
                 throw new \LogicException('/app folder not found.');
             }
             $cwd = dirname($cwd);
         }
         $config['app_dir'] = "{$cwd}/app";
     }
     $is_web_request = isset($_SERVER['SERVER_NAME']);
     $config += array('debug' => !$is_web_request || $_SERVER['SERVER_NAME'] == 'localhost', 'register_exception_handler' => $is_web_request, 'register_error_handler' => $is_web_request, 'core_dir' => __DIR__ . '/../..', 'data_dir' => "{$config['app_dir']}/../data");
     $this->exception_handler = new ExceptionHandler($this->debug);
     if ($this->register_exception_handler) {
         set_exception_handler(array($this->exception_handler, 'handle'));
     }
     if ($this->register_error_handler) {
         $this->errorHandler = \Symfony\Component\HttpKernel\Debug\ErrorHandler::register();
     }
     foreach (array($config['data_dir'], "{$config['data_dir']}/cache", "{$config['data_dir']}/logs") as $dir) {
         if (!is_dir($dir)) {
             mkdir($dir);
         }
     }
 }
开发者ID:z7,项目名称:hydra,代码行数:29,代码来源:Core.php


示例11: getAllClassNames

 public function getAllClassNames()
 {
     if (null === $this->classCache) {
         $this->initialize();
     }
     $classes = array();
     if ($this->paths) {
         foreach ((array) $this->paths as $path) {
             if (!is_dir($path)) {
                 throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
             }
             $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path), \RecursiveIteratorIterator::LEAVES_ONLY);
             foreach ($iterator as $file) {
                 $fileName = $file->getBasename($this->fileExtension);
                 if ($fileName == $file->getBasename() || $fileName == $this->globalBasename) {
                     continue;
                 }
                 // NOTE: All files found here means classes are not transient!
                 if (isset($this->prefixes[$path])) {
                     $classes[] = $this->prefixes[$path] . '\\' . str_replace('.', '\\', $fileName);
                 } else {
                     $classes[] = str_replace('.', '\\', $fileName);
                 }
             }
         }
     }
     return array_merge($classes, array_keys($this->classCache));
 }
开发者ID:ruian,项目名称:DoctrineCouchDBBundle,代码行数:28,代码来源:YamlDriver.php


示例12: __construct

 function __construct($name)
 {
     $this->folder = TEMP_FOLDER . '/' . $name;
     if (!is_dir($this->folder)) {
         mkdir($this->folder);
     }
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:7,代码来源:ManifestCache.php


示例13: submitInfo

 public function submitInfo()
 {
     $this->load->model("settings_model");
     // Gather the values
     $values = array('nickname' => htmlspecialchars($this->input->post("nickname")), 'location' => htmlspecialchars($this->input->post("location")));
     // Change language
     if ($this->config->item('show_language_chooser')) {
         $values['language'] = $this->input->post("language");
         if (!is_dir("application/language/" . $values['language'])) {
             die("3");
         } else {
             $this->user->setLanguage($values['language']);
             $this->plugins->onSetLanguage($this->user->getId(), $values['language']);
         }
     }
     // Remove the nickname field if it wasn't changed
     if ($values['nickname'] == $this->user->getNickname()) {
         $values = array('location' => $this->input->post("location"));
     } elseif (strlen($values['nickname']) < 4 || strlen($values['nickname']) > 14 || !preg_match("/[A-Za-z0-9]*/", $values['nickname'])) {
         die(lang("nickname_error", "ucp"));
     } elseif ($this->internal_user_model->nicknameExists($values['nickname'])) {
         die("2");
     }
     if (strlen($values['location']) > 32 && !ctype_alpha($values['location'])) {
         die(lang("location_error", "ucp"));
     }
     $this->settings_model->saveSettings($values);
     $this->plugins->onSaveSettings($this->user->getId(), $values);
     die("1");
 }
开发者ID:saqar,项目名称:FusionCMS-themes-and-modules,代码行数:30,代码来源:settings.php


示例14: getPoint

 /**
  * @brief Get the points
  */
 function getPoint($member_srl, $from_db = false)
 {
     $member_srl = abs($member_srl);
     // Get from instance memory
     if (!$from_db && $this->pointList[$member_srl]) {
         return $this->pointList[$member_srl];
     }
     // Get from file cache
     $path = sprintf(_XE_PATH_ . 'files/member_extra_info/point/%s', getNumberingPath($member_srl));
     $cache_filename = sprintf('%s%d.cache.txt', $path, $member_srl);
     if (!$from_db && file_exists($cache_filename)) {
         return $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename));
     }
     // Get from the DB
     $args = new stdClass();
     $args->member_srl = $member_srl;
     $output = executeQuery('point.getPoint', $args);
     if (isset($output->data->member_srl)) {
         $point = (int) $output->data->point;
         $this->pointList[$member_srl] = $point;
         if (!is_dir($path)) {
             FileHandler::makeDir($path);
         }
         FileHandler::writeFile($cache_filename, $point);
         return $point;
     }
     return 0;
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:31,代码来源:point.model.php


示例15: createSymbolicLink

 public static function createSymbolicLink($rootDir = null)
 {
     IS_MULTI_MODULES || exit('please set is_multi_modules => true');
     $deper = Request::isCli() ? PHP_EOL : '<br />';
     echo "{$deper}**************************create link start!*********************{$deper}";
     echo '|' . str_pad('', 64, ' ', STR_PAD_BOTH) . '|';
     is_null($rootDir) && ($rootDir = ROOT_PATH . DIRECTORY_SEPARATOR . 'web');
     is_dir($rootDir) || mkdir($rootDir, true, 0700);
     //modules_static_path_name
     // 递归遍历目录
     $dirIterator = new \DirectoryIterator(APP_MODULES_PATH);
     foreach ($dirIterator as $file) {
         if (!$file->isDot() && $file->isDir()) {
             $resourceDir = $file->getPathName() . DIRECTORY_SEPARATOR . Config::get('modules_static_path_name');
             if (is_dir($resourceDir)) {
                 $distDir = ROOT_PATH . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . $file->getFilename();
                 $cmd = Request::operatingSystem() ? "mklink /d {$distDir} {$resourceDir}" : "ln -s {$resourceDir} {$distDir}";
                 exec($cmd, $result);
                 $tip = "create link Application [{$file->getFilename()}] result : [" . (is_dir($distDir) ? 'true' : 'false') . "]";
                 $tip = str_pad($tip, 64, ' ', STR_PAD_BOTH);
                 print_r($deper . '|' . $tip . '|');
             }
         }
     }
     echo $deper . '|' . str_pad('', 64, ' ', STR_PAD_BOTH) . '|';
     echo "{$deper}****************************create link end!**********************{$deper}";
 }
开发者ID:phpdn,项目名称:framework,代码行数:27,代码来源:StaticResource.php


示例16: set

 /**
  * Sets data
  *
  * @param string $key
  * @param string $var
  * @param int $expire
  * @return boolean
  */
 function set($key, $var, $expire = 0)
 {
     $key = $this->get_item_key($key);
     $sub_path = $this->_get_path($key);
     $path = $this->_cache_dir . '/' . $sub_path;
     $sub_dir = dirname($sub_path);
     $dir = dirname($path);
     if (!@is_dir($dir)) {
         if (!w3_mkdir_from($dir, W3TC_CACHE_DIR)) {
             return false;
         }
     }
     $fp = @fopen($path, 'w');
     if (!$fp) {
         return false;
     }
     if ($this->_locking) {
         @flock($fp, LOCK_EX);
     }
     @fputs($fp, $var['content']);
     @fclose($fp);
     if ($this->_locking) {
         @flock($fp, LOCK_UN);
     }
     // some hostings create files with restrictive permissions
     // not allowing apache to read it later
     @chmod($path, 0644);
     $old_entry_path = $path . '.old';
     @unlink($old_entry_path);
     if (w3_is_apache() && isset($var['headers']) && isset($var['headers']['Content-Type']) && substr($var['headers']['Content-Type'], 0, 8) == 'text/xml') {
         file_put_contents(dirname($path) . '/.htaccess', "<IfModule mod_mime.c>\n" . "    RemoveType .html_gzip\n" . "    AddType text/xml .html_gzip\n" . "    RemoveType .html\n" . "    AddType text/xml .html\n" . "</IfModule>");
     }
     return true;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:42,代码来源:Generic.php


示例17: canRender

 /**
  * Returns if the file can be rendered.
  *
  * @return bool
  */
 public function canRender()
 {
     if (!is_dir($this->getTemplateDir() . $this->getTemplateFile())) {
         return false;
     }
     return is_file($this->getTemplateDir() . $this->getTemplateFile() . DIRECTORY_SEPARATOR . self::FILE_HTML) || is_file($this->getTemplateDir() . $this->getTemplateFile() . DIRECTORY_SEPARATOR . self::FILE_PHTML);
 }
开发者ID:kimai,项目名称:kimai,代码行数:12,代码来源:HtmlRenderer.php


示例18: runPathsMigration

 /**
  * Run paths migrations
  *
  * @return void
  */
 protected function runPathsMigration()
 {
     $_fileService = new Filesystem();
     $_tmpPath = app_path('storage') . DIRECTORY_SEPARATOR . 'migrations';
     if (!is_dir($_tmpPath) && !$_fileService->exists($_tmpPath)) {
         $_fileService->mkdir($_tmpPath);
     }
     $this->info("Gathering migration files to {$_tmpPath}");
     // Copy all files to storage/migrations
     foreach ($this->migrationList as $migration) {
         $_fileService->mirror($migration['path'], $_tmpPath);
     }
     //call migrate command on temporary path
     $this->info("Migrating...");
     $opts = array('--path' => ltrim(str_replace(base_path(), '', $_tmpPath), '/'));
     if ($this->input->getOption('force')) {
         $opts['--force'] = true;
     }
     if ($this->input->getOption('database')) {
         $opts['--database'] = $this->input->getOption('database');
     }
     $this->call('migrate', $opts);
     // Delete all temp migration files
     $this->info("Cleaning temporary files");
     $_fileService->remove($_tmpPath);
     // Done
     $this->info("DONE!");
 }
开发者ID:evertonteotonio,项目名称:laravel-modules,代码行数:33,代码来源:ModulesMigrateCommand.php


示例19: testWebsiteService

 public function testWebsiteService()
 {
     $website = $this->config->getService('website');
     $this->assertEquals(true, is_dir($website->htdocs()));
     $this->assertEquals('www.example.com', $website->name());
     $this->assertEquals('nginx', $website->webserver());
 }
开发者ID:browserfs,项目名称:website,代码行数:7,代码来源:ConfigTest.php


示例20: chmod_R

function chmod_R($path, $filemode)
{
    if (!is_dir($path)) {
        return chmod($path, $filemode);
    }
    $dh = opendir($path);
    while ($file = readdir($dh)) {
        if ($file != '.' && $file != '..') {
            $fullpath = $path . '/' . $file;
            if (!is_dir($fullpath)) {
                if (!chmod($fullpath, $filemode)) {
                    return FALSE;
                }
            } else {
                if (!chmod_R($fullpath, $filemode)) {
                    return FALSE;
                }
            }
        }
    }
    closedir($dh);
    if (chmod($path, $filemode)) {
        return true;
    } else {
        return false;
    }
}
开发者ID:pavpanchekha,项目名称:tullok,代码行数:27,代码来源:install.php



注:本文中的is_dir函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_dir_empty函数代码示例发布时间:2022-05-15
下一篇:
PHP is_digits函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap