当前位置: 首页>>代码示例>>PHP>>正文


PHP directory函数代码示例

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


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

示例1: perform

 /**
  * Perform command.
  */
 public function perform()
 {
     foreach ($this->files->getFiles(directory('config'), Core::EXTENSION) as $filename) {
         $this->files->touch($filename);
     }
     $this->writeln("All config files touched.");
 }
开发者ID:jwdeitch,项目名称:spiral,代码行数:10,代码来源:TouchCommand.php

示例2: staticCache

function staticCache($file, $line, $key, $callback = null)
{
    if (!isset($callback)) {
        $callback = $key;
        $key = null;
    }
    static $map;
    if (!isset($map)) {
        $map = (object) array();
    }
    if (isset($map->{"{$file}:{$line}-{$key}"})) {
        return $map->{"{$file}:{$line}-{$key}"};
    }
    $cacheFile = $_SERVER['cachePath'] . '/' . substr(pathinfo($file, PATHINFO_FILENAME), 0, 10) . '__' . substr(preg_replace('/(?i)[^a-z0-9]+/', '', $key), 0, 10) . '__' . sha1("{$file}:{$line}-{$key}") . '.cache';
    $cacheCorrelationFile = "{$cacheFile}.correlation";
    if (version_development && is_file($cacheCorrelationFile)) {
        foreach (array_diff(unserialize(file_get_contents($cacheCorrelationFile)), includedFile()) as $file) {
            if (is_file($file)) {
                includedFile($file);
            }
        }
    }
    if (!is_file($cacheFile) || version_development && filemtime($cacheFile) < lastCodeChangeTimestamp()) {
        directory(dirname($cacheFile));
        file_put_contents($cacheFile, serialize($callback()));
        file_put_contents($cacheCorrelationFile, serialize(includedFile()));
    }
    $map->{"{$file}:{$line}-{$key}"} = unserialize(file_get_contents($cacheFile));
    return $map->{"{$file}:{$line}-{$key}"};
}
开发者ID:luka8088,项目名称:phops,代码行数:30,代码来源:cache.php

示例3: perform

 /**
  * Perform command.
  */
 public function perform()
 {
     $this->isVerbosing() && $this->writeln("<info>Clearing application runtime cache:</info>");
     foreach ($this->files->getFiles(directory('cache')) as $filename) {
         !$this->option('emulate') && $this->files->delete($filename);
         $this->isVerbosing() && $this->writeln($this->files->relativePath($filename, directory('cache')));
     }
     $this->writeln("<info>Runtime cache has been cleared.</info>");
 }
开发者ID:jwdeitch,项目名称:spiral,代码行数:12,代码来源:ResetCommand.php

示例4: init

 public static function init(&$db, &$err, &$typehead)
 {
     $db = new r0mdauDb(_DIR_Database_);
     $err = new Error();
     form($err);
     $typehead['directory'] = directory();
     $typehead['lists'] = lists();
     $typehead['send'] = receiver();
 }
开发者ID:assistechnologie,项目名称:flashsms,代码行数:9,代码来源:class.Bootstrap.php

示例5: perform

 /**
  * Perform command.
  *
  * @param TokenizerInterface $tokenizer
  */
 public function perform(TokenizerInterface $tokenizer)
 {
     if (empty($modules = $this->modules->findModules($tokenizer))) {
         $this->writeln('<fg=red>' . 'No modules were found in any project file or library. Check Tokenizer config.' . '</fg=red>');
         return;
     }
     $table = $this->tableHelper(['Module:', 'Version:', 'Status:', 'Size:', 'Location:', 'Description:']);
     foreach ($modules as $module) {
         $table->addRow([$module->getName(), $this->fetchVersion($module->getName()), $module->isInstalled() ? self::INSTALLED : self::NOT_INSTALLED, StringHelper::bytes($module->getSize()), $this->files->relativePath($module->getLocation(), directory('root')), wordwrap($module->getDescription())]);
     }
     $table->render();
 }
开发者ID:jwdeitch,项目名称:spiral,代码行数:17,代码来源:ModulesCommand.php

示例6: stringListener

 /**
  * Realtime string highlighter.
  *
  * @return \Closure
  */
 private function stringListener()
 {
     return function (ObjectEvent $event) {
         $this->writeln("<fg=magenta>{$event->context()['string']}</fg=magenta>");
         if ($event->context()['class']) {
             $this->writeln("In class <comment>{$event->context()['class']}</comment>");
             return;
         }
         $filename = $this->files->relativePath($event->context()['filename'], directory('root'));
         $this->writeln("In <comment>{$filename}</comment> at line <comment>{$event->context()['line']}</comment>");
     };
 }
开发者ID:jwdeitch,项目名称:spiral,代码行数:17,代码来源:IndexCommand.php

示例7: perform

 /**
  * Perform command.
  */
 public function perform()
 {
     $host = $this->argument('host') . ':' . $this->option('port');
     $this->writeln("<info>Spiral Development server started at <comment>{$host}</comment></info>");
     $this->writeln("Press <comment>Ctrl-C</comment> to quit.");
     $process = new Process('"' . PHP_BINARY . '" -S ' . $host . ' "' . directory('framework') . '/../server.php"', directory('public'), null, null, $this->option('timeout'));
     $process->run(function ($type, $data) {
         if ($type != Process::ERR) {
             //First character contains request type, second is space
             ($data[0] == 'S' || $this->isVerbosing()) && $this->writeln(substr($data, 2));
         }
     });
 }
开发者ID:jwdeitch,项目名称:spiral,代码行数:16,代码来源:ServerCommand.php

示例8: perform

 /**
  * Perform command.
  */
 public function perform()
 {
     /**
      * We are going to manipulate with encrypter configuration.
      *
      * @var ConfigWriter $write
      */
     $configWriter = $this->container->get(ConfigWriter::class, ['name' => 'encrypter', 'method' => ConfigWriter::MERGE_REPLACE]);
     $key = StringHelper::random(32);
     //Exporting to environment specific configuration file
     $configWriter->setConfig(compact('key'))->writeConfig(directory('config') . '/' . $this->core->environment());
     $this->writeln("<info>Encryption key <comment>{$key}</comment> was set for environment " . "<comment>{$this->core->environment()}</comment>.</info>");
 }
开发者ID:jwdeitch,项目名称:spiral,代码行数:16,代码来源:KeyCommand.php

示例9: getAlteredConfigs

 /**
  * List of configs affected by environment change.
  *
  * @param string $environment
  * @return array
  */
 protected function getAlteredConfigs($environment)
 {
     //We have to touch every config to ensure that cache is OK
     $configDirectory = $this->files->normalizePath(directory('config'));
     $environmentDirectory = $configDirectory . "/{$environment}/";
     $altered = [];
     foreach ($this->files->getFiles($configDirectory, Core::EXTENSION) as $filename) {
         $environmentConfig = $environmentDirectory . basename($filename);
         if (dirname($filename) == $configDirectory && $this->files->exists($environmentConfig)) {
             $altered[] = $this->files->relativePath($filename, $configDirectory);
         }
     }
     return $altered;
 }
开发者ID:jwdeitch,项目名称:spiral,代码行数:20,代码来源:EnvironmentCommand.php

示例10: ensurePermissions

 /**
  * @param DirectoriesInterface $directories
  * @param FilesInterface       $files
  */
 protected function ensurePermissions(DirectoriesInterface $directories, FilesInterface $files)
 {
     $this->writeln("<info>Verifying runtime directory existence and file permissions...</info>");
     $runtime = $directories->directory('runtime');
     if (!$files->exists(directory('runtime'))) {
         $files->ensureDirectory(directory('runtime'));
         $this->writeln("Runtime data directory was created.");
         return;
     }
     foreach ($files->getFiles(directory('runtime')) as $filename) {
         //Both file and it's directory must be writable
         $files->setPermissions($filename, FilesInterface::RUNTIME);
         $files->setPermissions(dirname($filename), FilesInterface::RUNTIME);
     }
     $this->writeln("Runtime directory permissions were updated.");
 }
开发者ID:vvval,项目名称:spiral,代码行数:20,代码来源:ConfigureCommand.php

示例11: codeChanged

function codeChanged()
{
    static $includedFiles = array();
    static $result = true;
    $newIncludedFiles = includedFile();
    if (count($includedFiles) != count($newIncludedFiles)) {
        $fingerprintFile = $_SERVER['cachePath'] . '/codeBase_' . sha1(serialize($newIncludedFiles)) . '.timestamp';
        $result = !is_file($fingerprintFile) || codeTimestamp() > filemtime($fingerprintFile);
        if ($result) {
            directory(dirname($fingerprintFile));
            $touchResult = touch($fingerprintFile);
            enforce($touchResult, "Could not touch '{$fingerprintFile}'");
        }
        $includedFiles = $newIncludedFiles;
    }
    return $result;
}
开发者ID:luka8088,项目名称:phops,代码行数:17,代码来源:index.php

示例12: ensureRuntimeDirectory

 /**
  * Ensure existence and permissions of runtime directory.
  */
 protected function ensureRuntimeDirectory()
 {
     $this->writeln("<info>Verifying runtime directory existence and file permissions...</info>");
     if (!$this->files->exists(directory('runtime'))) {
         $this->files->ensureLocation(directory('runtime'));
         $this->writeln("Runtime data directory was created.");
         return;
     }
     foreach ($this->files->getFiles(directory('runtime')) as $filename) {
         //Both file and it's directory must be writable
         $this->files->setPermissions($filename, FilesInterface::RUNTIME);
         $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME);
         if ($this->isVerbosing()) {
             $filename = $this->files->relativePath($filename, directory('runtime'));
             $this->writeln("Permissions were updated for '<comment>{$filename}</comment>'.");
         }
     }
     $this->writeln("Runtime directory permissions updated.");
 }
开发者ID:jwdeitch,项目名称:spiral,代码行数:22,代码来源:ConfigureCommand.php

示例13: displayThumbs

function displayThumbs($imagefolder, $thumbsfolder, $maxthumbnailsize, $imagesperrow, $rowsperpage)
{
    if (!isset($_GET['page'])) {
        $page = "1";
    } else {
        $page = $_GET['page'];
    }
    if ($page == "all") {
        $lastpic = 9999999999999;
        $pictostartat = 0;
    } else {
        $lastpic = $rowsperpage * $imagesperrow * $page;
        $pictostartat = $lastpic - $rowsperpage * $imagesperrow;
    }
    $pics = directory($imagefolder, "jpg,JPG,JPEG,jpeg,png,PNG");
    $maxsize = $maxthumbnailsize;
    if (isset($pics[0]) && $pics[0] != "") {
        echo "<table><tr>";
        $COUNT = 0;
        foreach ($pics as $p) {
            if ($COUNT < $pictostartat) {
                $COUNT = $COUNT + 1;
                continue;
            } else {
                if ($COUNT >= $lastpic) {
                    $COUNT = $COUNT + 1;
                    continue;
                } else {
                    $COUNT = $COUNT + 1;
                }
            }
            displayImage($imagefolder, $p, $thumbsfolder, $maxsize, FALSE);
            if ($COUNT % $imagesperrow == 0) {
                echo "</tr><tr>";
            }
        }
        echo "</tr></table>";
    }
}
开发者ID:BGCX261,项目名称:zippyphotos-svn-to-git,代码行数:39,代码来源:utilities.php

示例14: directory

<?php

/**
 * Configuration of ViewManager component and view engines:
 * - compiled view cache state and location
 * - view namespaces associated with list of source directories
 * - list of view dependencies, used by default compiler to create unique cache name
 * - list of view engines associated with their extension, compiler and default view class
 */
return ['cache' => ['enabled' => true, 'directory' => directory("cache") . 'views/'], 'namespaces' => ['default' => [directory("application") . 'views/'], 'spiral' => [directory("application") . 'views/spiral/', directory("libraries") . 'spiral/framework/source/views/', directory("libraries") . 'spiral/toolkit/source/views/'], 'profiler' => [directory("libraries") . 'spiral/profiler/source/views/']], 'dependencies' => ['language' => ['i18n', 'getLanguage'], 'basePath' => ['http', 'basePath']], 'engines' => ['default' => ['extensions' => ['php'], 'compiler' => 'Spiral\\Views\\Compiler', 'view' => 'Spiral\\Views\\View', 'processors' => ['Spiral\\Views\\Processors\\ExpressionsProcessor' => [], 'Spiral\\Views\\Processors\\TranslateProcessor' => [], 'Spiral\\Views\\Processors\\TemplateProcessor' => [], 'Spiral\\Views\\Processors\\EvaluateProcessor' => [], 'Spiral\\Views\\Processors\\PrettifyProcessor' => [], 'Spiral\\Toolkit\\ResourceManager' => []]]]];
开发者ID:jwdeitch,项目名称:Concessions,代码行数:10,代码来源:views.php

示例15: directory

<?php

/**
 * Configuration of Migrator component (located in Database component), includes:
 * - directory to store migrations in
 * - database to store information about executed migrations
 * - table to store information about executed migrations
 * - list of environments where migration commands allowed to run without user confirmation
 */
return ['directory' => directory('application') . 'migrations/', 'database' => 'default', 'table' => 'migrations', 'environments' => ['development', 'testing', 'staging']];
开发者ID:jwdeitch,项目名称:Concessions,代码行数:10,代码来源:migrations.php


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