本文整理汇总了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;
}
示例2: setUp
protected function setUp()
{
$this->app->backup();
$this->workingDir = getCwd();
chDir($GLOBALS['application']->rootDir);
$this->application = new \Nano\Application();
}
示例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());
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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... ";
示例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));
示例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>
示例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;
}
示例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>
示例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();
}
}
示例14: testDetectingDefaultApplicationRootDir
public function testDetectingDefaultApplicationRootDir()
{
self::assertFalse($this->application->offsetExists('rootDir'));
$this->application->withConfigurationFormat('php')->configure();
self::assertEquals(getCwd(), $this->application->rootDir);
}
示例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;
}