本文整理汇总了PHP中HTTP::getcwd方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::getcwd方法的具体用法?PHP HTTP::getcwd怎么用?PHP HTTP::getcwd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTP
的用法示例。
在下文中一共展示了HTTP::getcwd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: head
/**
* head
*
* @return string
*/
public function head()
{
if (Config::get('Gmanager', 'mode') != 'FTP') {
$realpath = self::$_instance->realpath(Registry::get('current'));
$realpath = $realpath ? $realpath : Registry::get('current');
} else {
$realpath = Registry::get('current');
}
$chmod = $this->lookChmod(Registry::get('current'));
$chmod = $chmod ? $chmod : (isset($_POST['chmod'][0]) ? htmlspecialchars($_POST['chmod'][0], ENT_NOQUOTES) : (isset($_POST['chmod']) ? htmlspecialchars($_POST['chmod'], ENT_NOQUOTES) : 0));
$d = dirname(str_replace('\\', '/', $realpath));
$archive = Helper_Archive::isArchive(Helper_System::getType(Helper_System::basename(Registry::get('current'))));
if (Registry::get('currentType') == 'dir' || Registry::get('currentTypeLink') == 'dir') {
if (Registry::get('current') == '.') {
return '<div class="border">' . Language::get('dir') . ' <a href="?">' . htmlspecialchars(Helper_View::strLink(self::$_instance->getcwd()), ENT_NOQUOTES) . '</a> (' . $this->lookChmod(self::$_instance->getcwd()) . ')<br/></div>';
} else {
return '<div class="border">' . Language::get('back') . ' <a href="?c=' . Helper_View::getRawurl($d) . '">' . $d . '</a> (' . $this->lookChmod($d) . ')<br/></div><div class="border">' . Language::get('dir') . ' <a href="?c=' . Registry::get('rCurrent') . '">' . htmlspecialchars(str_replace('\\', '/', Helper_View::strLink($realpath)), ENT_NOQUOTES) . '</a> (' . $chmod . ')<br/></div>';
}
} elseif (Registry::get('currentType') == 'file' && $archive) {
$up = dirname($d);
return '<div class="border">' . Language::get('back') . ' <a href="?c=' . Helper_View::getRawurl($up) . '">' . htmlspecialchars(Helper_View::strLink($up), ENT_NOQUOTES) . '</a> (' . $this->lookChmod($up) . ')<br/></div><div class="border">' . Language::get('dir') . ' <a href="?c=' . Helper_View::getRawurl($d) . '">' . htmlspecialchars(Helper_View::strLink($d), ENT_NOQUOTES) . '</a> (' . $this->lookChmod($d) . ')<br/></div><div class="border">' . Language::get('file') . ' <a href="?c=' . Registry::get('rCurrent') . '">' . htmlspecialchars(str_replace('\\', '/', Helper_View::strLink($realpath)), ENT_NOQUOTES) . '</a> (' . $chmod . ')<br/></div>';
} else {
$up = dirname($d);
return '<div class="border">' . Language::get('back') . ' <a href="?c=' . Helper_View::getRawurl($up) . '">' . htmlspecialchars(Helper_View::strLink($up), ENT_NOQUOTES) . '</a> (' . $this->lookChmod($up) . ')<br/></div><div class="border">' . Language::get('dir') . ' <a href="?c=' . Helper_View::getRawurl($d) . '">' . htmlspecialchars(Helper_View::strLink($d), ENT_NOQUOTES) . '</a> (' . $this->lookChmod($d) . ')<br/></div><div class="border">' . Language::get('file') . ' <a href="?gmanager_action=edit&c=' . Registry::get('rCurrent') . '">' . htmlspecialchars(str_replace('\\', '/', Helper_View::strLink($realpath)), ENT_NOQUOTES) . '</a> (' . $chmod . ')<br/></div>';
}
}
示例2: createDir
/**
* createDir
*
* @param string $dir
* @param mixed $chmod
* @return string
*/
public function createDir($dir = '', $chmod = 0755)
{
$tmp = $tmp2 = $err = '';
$i = 0;
$g = explode(DIRECTORY_SEPARATOR, self::$_instance->getcwd());
foreach (explode('/', $dir) as $d) {
$tmp .= $d . '/';
if (isset($g[$i])) {
$tmp2 .= $g[$i] . '/';
}
if ($tmp == $tmp2 || self::$_instance->is_dir($tmp)) {
$i++;
continue;
}
if (!self::$_instance->mkdir($tmp, $chmod)) {
$err .= Errors::get() . ' -> ' . htmlspecialchars($tmp, ENT_NOQUOTES) . '<br/>';
}
$i++;
}
if ($err) {
return Helper_View::message(Language::get('create_dir_false') . '<br/>' . $err, Helper_View::MESSAGE_ERROR_EMAIL);
} else {
return Helper_View::message(Language::get('create_dir_true'), Helper_View::MESSAGE_SUCCESS);
}
}