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


PHP getCwd函数代码示例

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


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

示例1: configure

 /**
  * @return \Nano\Application
  *
  * @throws \Nano\Application\Exception\InvalidConfiguration
  */
 public function configure()
 {
     if (!$this->offsetExists('configFormat')) {
         throw new Application\Exception\InvalidConfiguration('Configuration format not specified');
     }
     \Nano::setApplication($this);
     if (!$this->offsetExists('rootDir')) {
         $this->withRootDir(getCwd());
     }
     if (!$this->offsetExists('publicDir')) {
         $this->withPublicDir($this->rootDir . DIRECTORY_SEPARATOR . self::PUBLIC_DIR_NAME);
     }
     if (!$this->offsetExists('modulesDir')) {
         $this->withModulesDir($this->rootDir . DIRECTORY_SEPARATOR . self::MODULES_DIR_NAME);
     }
     if (!$this->offsetExists('sharedModulesDir')) {
         $this->withSharedModulesDir($this->nanoRootDir . DIRECTORY_SEPARATOR . self::MODULES_DIR_NAME);
     }
     if ('cli' !== php_sapi_name()) {
         $this->errorHandler = new Application\ErrorHandler();
     }
     $this->readOnly('config', new Application\Config($this->rootDir . DIRECTORY_SEPARATOR . 'settings', $this->configFormat));
     $this->setupErrorReporting();
     return $this;
 }
开发者ID:visor,项目名称:nano,代码行数:30,代码来源:Application.php

示例2: setUp

 protected function setUp()
 {
     $this->app->backup();
     $this->workingDir = getCwd();
     chDir($GLOBALS['application']->rootDir);
     $this->application = new \Nano\Application();
 }
开发者ID:visor,项目名称:nano,代码行数:7,代码来源:Abstract.php

示例3: setUp

 protected function setUp()
 {
     $this->app->backup();
     ob_start();
     $this->setUseOutputBuffering(true);
     $this->appRoot = dirName(__DIR__) . '/Application/_files';
     $this->cwd = getCwd();
     $this->cli = new \Nano\Cli();
     chDir($this->appRoot);
     $this->cli->run(array());
 }
开发者ID:visor,项目名称:nano,代码行数:11,代码来源:ScriptInfoTest.php

示例4: __construct

 public function __construct($name, $options = null)
 {
     $this->name = $name;
     if ($options != null) {
         $this->options = $options;
     }
     if ($this->options & self::OPTION_CHDIR) {
         $this->workingDir = getCwd();
         $newCwd = dirname(debug_backtrace()[0]['file']);
         chdir($newCwd);
     }
 }
开发者ID:aichingm,项目名称:Pest,代码行数:12,代码来源:Pest.php

示例5: setUp

 protected function setUp()
 {
     $this->app->backup();
     ob_start();
     $this->setUseOutputBuffering(true);
     $application = new \Nano\Application();
     $application->withRootDir($GLOBALS['application']->rootDir)->withConfigurationFormat('php')->configure();
     $this->appRoot = dirName(__DIR__) . '/Application/_files';
     $this->nanoRoot = $application->nanoRootDir;
     $this->cwd = getCwd();
     $this->cli = new \Nano\Cli();
     chDir($this->appRoot);
 }
开发者ID:visor,项目名称:nano,代码行数:13,代码来源:CommonTest.php

示例6: run

 /**
  * @return void
  * @param string[] $args
  */
 public function run(array $args)
 {
     $this->path = isset($args[0]) ? $args[0] : getCwd();
     if (!file_exists($this->path)) {
         mkDir($this->path, 0755, true);
     }
     if (!is_dir($this->path)) {
         $this->stop($this->path . ' is not directory', 1);
     }
     if (!is_writable($this->path)) {
         $this->stop('Cannot write into directory ' . $this->path, 1);
     }
     echo 'Creating module skeleton in ' . $this->path, PHP_EOL;
     $this->defaults = __DIR__ . DIRECTORY_SEPARATOR . 'app';
     $this->createDirectoryStructure();
     echo 'Done.', PHP_EOL;
 }
开发者ID:visor,项目名称:nano,代码行数:21,代码来源:module.php

示例7: __construct

 public function __construct($theClass = '', $name = '')
 {
     $this->setName(get_class($this));
     $zendPath = getCwd();
     chdir(realpath(dirname(__FILE__)));
     require_once 'PHPUnit/Util/Configuration.php';
     // test phpUnit version
     if (version_compare(PHPUnit_Runner_Version::id(), '3.4', '>=')) {
         $configuration = PHPUnit_Util_Configuration::getInstance('phpunit.xml');
     } else {
         $configuration = new PHPUnit_Util_Configuration('phpunit.xml');
     }
     $testSuite = $configuration->getTestSuiteConfiguration(false);
     chdir($zendPath);
     foreach ($testSuite->tests() as $test) {
         if (!$test instanceof PHPUnit_Framework_Warning) {
             $this->addTestSuite($test);
         }
     }
 }
开发者ID:r-kovalenko,项目名称:Rediska,代码行数:20,代码来源:bootstrap.php

示例8: error_reporting

 * PHP version 5
 *
 * @category  PHP
 * @package   PHP_CodeSniffer
 * @author    Benjamin Pearson <bpearson@squiz.com.au>
 * @author    Greg Sherwood <gsherwood@squiz.net>
 * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
 * @license   https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
 * @link      http://pear.php.net/package/PHP_CodeSniffer
 */
error_reporting(E_ALL | E_STRICT);
if (ini_get('phar.readonly') === '1') {
    echo 'Unable to build, phar.readonly in php.ini is set to read only.' . PHP_EOL;
    exit(1);
}
$cwd = getCwd();
require_once __DIR__ . '/../CodeSniffer.php';
$scripts = array('phpcs', 'phpcbf');
foreach ($scripts as $script) {
    echo "Building {$script} phar" . PHP_EOL;
    $pharFile = $cwd . '/' . $script . '.phar';
    echo "\t=> {$pharFile}" . PHP_EOL;
    if (file_exists($pharFile) === true) {
        echo "\t** file exists, removing **" . PHP_EOL;
        unlink($pharFile);
    }
    $phar = new Phar($pharFile, 0, $script . '.phar');
    echo "\t=> adding files from package.xml... ";
    buildFromPackage($phar);
    echo 'done' . PHP_EOL;
    echo "\t=> adding stub... ";
开发者ID:Makiss,项目名称:test_guestbook_mvc,代码行数:31,代码来源:build-phar.php

示例9: pre_uninstall

                include $file;
                pre_uninstall();
            }
            break;
        default:
            break;
    }
}
//
// perform the action
//
for ($iii = 0; $iii < $_REQUEST['copy_count']; $iii++) {
    if (isset($_REQUEST["copy_" . $iii]) && $_REQUEST["copy_" . $iii] != "") {
        $file_to_copy = $_REQUEST["copy_" . $iii];
        $src_file = clean_path("{$unzip_dir}/{$zip_from_dir}/{$file_to_copy}");
        $sugar_home_dir = getCwd();
        $dest_file = clean_path("{$sugar_home_dir}/{$zip_to_dir}/{$file_to_copy}");
        if ($zip_to_dir != '.') {
            $rest_file = clean_path("{$rest_dir}/{$zip_to_dir}/{$file_to_copy}");
        } else {
            $rest_file = clean_path("{$rest_dir}/{$file_to_copy}");
        }
        switch ($mode) {
            case "Install":
                mkdir_recursive(dirname($dest_file));
                if ($install_type == "patch" && is_file($dest_file)) {
                    if (!is_dir(dirname($rest_file))) {
                        mkdir_recursive(dirname($rest_file));
                    }
                    copy($dest_file, $rest_file);
                    sugar_touch($rest_file, filemtime($dest_file));
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:UpgradeWizard_commit.php

示例10: e

<?php

function e($str, $rtn = false)
{
    if ($rtn === false) {
        echo htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
    } else {
        return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
    }
}
?>
<html>
<title><?php 
e(getCwd());
?>
</title>
<body>
<h1>Index of <?php 
e(getCwd());
?>
</h1> 
<hr>
<?php 
foreach (glob('*') as $filename) {
    echo "<a href='" . e($filename, 1) . "'>" . e($filename, 1) . "</a><br>";
}
?>
</body>
</html>
开发者ID:uzulla,项目名称:php_directory_index,代码行数:29,代码来源:index.php

示例11: checkDestinationFolder

 /**
  * @return string
  */
 protected function checkDestinationFolder()
 {
     echo 'Checking destination directory', PHP_EOL;
     $destination = getCwd() . DIRECTORY_SEPARATOR . self::DIR_DEPENCIES;
     if (file_exists($destination) && !is_dir($destination)) {
         echo '   Not directory, ignore', PHP_EOL;
         exit;
     }
     if (!file_exists($destination)) {
         mkDir($destination, 0755, true);
     }
     echo 'Done', PHP_EOL;
     return $destination;
 }
开发者ID:visor,项目名称:nano,代码行数:17,代码来源:dependencies.php

示例12: phpinfo

<?php

phpinfo();
include "inc/conf.php";
echo "<center><table>";
echo "<tr><td>LxO Pfad:</td><td>" . getCwd() . "</td></tr>";
?>
</table>
<a href="status.php">Status</a>
</center>
开发者ID:vanloswang,项目名称:kivitendo-crm,代码行数:10,代码来源:info.php

示例13: detectApplicationDirectory

 /**
  * @return boolean
  */
 protected function detectApplicationDirectory()
 {
     $dir = getCwd();
     $found = false;
     do {
         if (file_exists($dir . DS . self::BOOTSTRAP)) {
             $found = true;
             $this->applicationDir = $dir;
         } else {
             $dir = dirName($dir);
         }
     } while (!$found && strLen($dir) > 1);
     if ($found) {
         $this->loadApplication();
     }
 }
开发者ID:visor,项目名称:nano,代码行数:19,代码来源:Cli.php

示例14: testDetectingDefaultApplicationRootDir

 public function testDetectingDefaultApplicationRootDir()
 {
     self::assertFalse($this->application->offsetExists('rootDir'));
     $this->application->withConfigurationFormat('php')->configure();
     self::assertEquals(getCwd(), $this->application->rootDir);
 }
开发者ID:visor,项目名称:nano,代码行数:6,代码来源:ConfigurationTest.php

示例15: findAllFilesRelative

function findAllFilesRelative($the_dir, $the_array)
{
    $original_dir = getCwd();
    chdir($the_dir);
    $the_array = findAllFiles(".", $the_array);
    chdir($original_dir);
    return $the_array;
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:8,代码来源:dir_inc.php


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