當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTTP::getcwd方法代碼示例

本文整理匯總了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&amp;c=' . Registry::get('rCurrent') . '">' . htmlspecialchars(str_replace('\\', '/', Helper_View::strLink($realpath)), ENT_NOQUOTES) . '</a> (' . $chmod . ')<br/></div>';
     }
 }
開發者ID:Halilli,項目名稱:gmanager,代碼行數:31,代碼來源:Gmanager.php

示例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() . ' -&gt; ' . 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);
     }
 }
開發者ID:thaian2009,項目名稱:php,代碼行數:32,代碼來源:Gmanager.php


注:本文中的HTTP::getcwd方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。