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


PHP Path::join方法代码示例

本文整理汇总了PHP中Path::join方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::join方法的具体用法?PHP Path::join怎么用?PHP Path::join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


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

示例1: chdir

 private function chdir($ftp, $splitPaths)
 {
     $passedPaths = [];
     foreach ($splitPaths as $splitPath) {
         $passedPaths[] = $splitPath;
         $ok = @ftp_chdir($ftp, $splitPath);
         if (!$ok) {
             throw new FolderNotFoundException(Path::join($passedPaths));
         }
     }
 }
开发者ID:ufosky-server,项目名称:Gvirila,代码行数:11,代码来源:FtpProxy.php

示例2: __toString

 public function __toString()
 {
     $filename = Path::join(array($path, 'images', 'famfamfam', $this->name));
     if (substr($filename, -4) != '.png') {
         $filename .= '.png';
     }
     if (is_readable($filename)) {
         return file_get_contents($filename);
     } else {
         return '';
     }
 }
开发者ID:joksnet,项目名称:php-old,代码行数:12,代码来源:Icon.php

示例3: __construct

 public function __construct($argv = array())
 {
     $filename = empty($argv[0]) ? 'redirect' : $argv[0];
     $filename = Path::join(array($path, 'html', $filename));
     if (substr($filename, -5) != '.html') {
         $filename .= '.html';
     }
     if (is_readable($filename)) {
         $this->filename = $filename;
     }
     //-->
     if (isset($_GET['compress'])) {
         $this->options['compress'] = $_GET['compress'];
     }
 }
开发者ID:joksnet,项目名称:php-old,代码行数:15,代码来源:Html.php

示例4: __construct

 public function __construct($argv = array())
 {
     if (!empty($argv[0])) {
         $className = $this->name($argv[0]);
         $fileName = Path::join(array('api', $className));
         if (substr($fileName, -4) != '.php') {
             $fileName .= '.php';
         }
         if (is_readable($fileName)) {
             $this->filename = $fileName;
             $this->className = $className;
             $this->dispatch();
         }
     }
 }
开发者ID:joksnet,项目名称:php-old,代码行数:15,代码来源:Api.php

示例5: real

 public static function real($path)
 {
     $path = Path::split($path);
     $newpath = array();
     while (list(, $v) = each($path)) {
         switch ($v) {
             case '.':
                 continue;
             case '..':
                 array_pop($newpath);
                 continue;
             default:
                 $newpath[] = $v;
         }
     }
     return Path::join($newpath);
 }
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:17,代码来源:ns_path.php

示例6: __construct

 public function __construct($argv = array())
 {
     $filename = Path::join(array('css', $argv[0]));
     if (substr($filename, -4) != '.css') {
         $filename .= '.css';
     }
     if (is_readable($filename)) {
         $this->filename = $filename;
     }
     //-->
     if (isset($_GET['compress'])) {
         $this->options['compress'] = $_GET['compress'];
     }
     //-->
     if (empty($this->filename)) {
         $this->parseAll();
     } elseif (is_readable($this->filename)) {
         $this->css[$this->filename] = $this->parse(file_get_contents($this->filename));
     }
 }
开发者ID:joksnet,项目名称:php-old,代码行数:20,代码来源:Css.php

示例7: saveToFile

 /**
  * Save image to given file.
  *
  * @param string $fname      filename
  * @param string $format     possible values in self::$formats
  * @param integer $quality   quality of output jpeg
  * @param boolean $overwrite if true, it overwrite file if it exists
  *
  * @throws CEFilesystemError ({@link CEFileSystemError description})
  *
  * @access public
  */
 public function saveToFile($fname, $format = null, $quality = null, $overwrite = false)
 {
     $this->isInitialized();
     $pathinfo = pathinfo($fname);
     if (is_null($format)) {
         $format = $pathinfo['extension'];
     }
     $format = $this->checkFormat(strtolower($format));
     if ('' == $pathinfo['dirname']) {
         $pathinfo['dirname'] = '.';
     }
     $pathinfo['dirname'] = realpath($pathinfo['dirname']);
     $fullpath = Path::join($pathinfo['dirname'], $pathinfo['basename']);
     if (!is_writeable($pathinfo['dirname'])) {
         throw new CEFileSystemError(sprintf('Cannot write to "%s" directory.', $pathinfo['dirname']), 300);
     }
     if (file_exists($fullpath)) {
         if ($overwrite) {
             unlink($fullpath);
         } else {
             throw new CEFileSystemError(sprintf('File "%s" already exists.', $fullpath), 301);
         }
     }
     if (is_null($quality)) {
         $quality = self::QUALITY;
     }
     $fun = self::$formats[$format];
     $fun($this->body, $fname, $quality);
 }
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:41,代码来源:class_image.php

示例8: searchFiles

 function searchFiles($path, $name, $content)
 {
     if ($name === '' && $content === '') {
         throw new NameException();
     }
     $parent = $this->rootFolder;
     if ($parent->isProxy) {
         if ($parent->canSearch) {
             return $parent->searchFiles($path, $name, $content);
         }
         return [];
     }
     $splitPaths = Path::split($path);
     $passedFolders = [];
     while ($splitPaths) {
         $folderName = array_shift($splitPaths);
         $passedFolders[] = $folderName;
         $item = $parent->get($folderName);
         if (!$item) {
             throw new FolderNotFoundException(Path::join($passedFolders));
         } else {
             if ($item instanceof File) {
                 throw new NotAFolderException($path);
             } elseif ($item->isProxy) {
                 if ($item->canSearch) {
                     $files = $item->searchFiles(Path::join($splitPaths), $name, $content);
                     foreach ($files as &$file) {
                         $file['path'] = Path::join([$path, $file['path']]);
                     }
                     return $files;
                 }
                 throw new NotAFolderException(Path::join($passedFolders));
             }
         }
         $parent = $item;
     }
     $files = $parent->searchFiles($name, $content);
     foreach ($files as &$file) {
         $file['path'] = Path::join([$path, $file['path']]);
     }
     return $files;
 }
开发者ID:ufosky-server,项目名称:Gvirila,代码行数:42,代码来源:FileSystem.php

示例9: strtolower

        return;
    }
    $fname = strtolower($classname);
    $fname = str_replace('_', '', $fname);
    $fname1 = sprintf(ROOT . '%sinc%sclass_%s.php', DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $fname);
    if (is_file($fname1)) {
        require_once $fname1;
        return;
    }
    $fname2 = sprintf(ROOT . '%sinc%sns_%s.php', DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $fname);
    if (is_file($fname2)) {
        require_once $fname2;
        return;
    }
    echo $fname1 . '<br />';
    echo $fname2 . '<br />';
}
require_once sprintf('..%sconfig.php', DIRECTORY_SEPARATOR);
$config = new CoreConfig();
/*
new CoreInit(
    $config->enc_from,
    $config->enc_to,
    $config->comp_level,
    $config->email
);
*/
define('OPT_DIR', Path::join(ROOT, 'inc', 'opt') . DIRECTORY_SEPARATOR);
require_once Path::join(ROOT, 'inc', 'opt', 'opt.class.php');
$auth = new Auth();
echo $auth->authenticate('mysz', sha1('jsDhzc1'));
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:31,代码来源:index.php

示例10: walk

 /**
  * Recursive walk into directory and return it's content.
  *
  * @param string  $dir directory to scan
  * @param boolean $assoc return associative or normal array
  * @param integer $maxLevel how deep scan $dir
  *
  * @return array
  * @throws CENotFound ({@link CENotFound description})
  *
  * @access public
  */
 public static function walk($dir, $assoc = false, $maxLevel = false, $curLevel = 1)
 {
     $dir = Path::real($dir);
     $ret = array();
     $data = Path::listdir($dir, self::SORT_ASC, true);
     if ($assoc) {
         $ret[$dir] = array('dirs' => $data['dirs'], 'files' => $data['files']);
     } else {
         $ret[] = array($dir, $data['dirs'], $data['files']);
     }
     if (false === $maxLevel || $maxLevel > $curLevel) {
         foreach ($data['dirs'] as $d) {
             $path = Path::join($dir, $d);
             $ret = array_merge($ret, Path::walk($path, $assoc, $maxLevel, $curLevel + 1));
         }
     }
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:30,代码来源:ns_path.php

示例11: __construct

 /**
  * Constructor
  *
  * Checks for valid parameters, and initializes proper options.
  *
  * @param string  $enc_from   character set of files (present)
  * @param string  $enc_to     output character set
  * @param integer $comp_level
  * @param array   $incpath    elements of include path
  *
  * @access public
  */
 public function __construct(&$enc_from = null, &$enc_to = null, &$comp_level = null, &$email = null, &$incPath = null)
 {
     if (is_null($incPath)) {
         $this->_incPath = array(ROOT, Path::join(ROOT, 'inc'));
     } else {
         $this->_incPath = $incPath;
     }
     if (!is_null($email) && Validate::email($email)) {
         $this->_email = $email;
     }
     if (is_null($comp_level)) {
         $comp_level = self::COMP_LEVEL;
     }
     if (is_null($enc_from)) {
         $enc_from = self::ENC_FROM;
     }
     if (is_null($enc_to)) {
         $enc_to = self::ENC_TO;
     }
     if (defined('DEBUG') && DEBUG) {
         $this->_debug = true;
     }
     $ob_start_opts = array();
     if ($comp_level > 0) {
         $comp = $this->_initCompress($comp_level);
         if ($comp !== false) {
             $ob_start_opts[] = $comp;
         }
     }
     if ($enc_from !== $enc_to) {
         $enc = $this->_initEncoding($enc_from, $enc_to);
         if ($enc !== false) {
             $ob_start_opts[] = $enc;
         }
     }
     if (count($ob_start_opts) > 0) {
         ob_start($ob_start_opts);
         $this->_initialized = true;
     } else {
         $this->_initialized = false;
     }
     $this->_initPhpSettings();
 }
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:55,代码来源:class_coreinit.php

示例12: searchFiles

 function searchFiles($path, $name, $content)
 {
     $splitPaths = Path::split($path);
     $this->chdir($splitPaths);
     $files = $this->searchFilesRecursive($name, $content, []);
     foreach ($files as &$file) {
         $file['path'] = Path::join([$path, $file['path']]);
     }
     return $files;
 }
开发者ID:ufosky-server,项目名称:Gvirila,代码行数:10,代码来源:FileSystemProxy.php

示例13: save

 /**
  * Save uploaded file in destionation directory
  *
  * Use addtional methods, {@link Upload::preSave()} and {@link Upload::postSave()}
  * for other operations, needed on uploaded file (like check for proper
  * size etc).
  *
  * @param string  $dest destination directory (if other then {@link Upload::$saveDir})
  * @param boolean $genName use original filename to store, or generated
  * @param boolean $overwrite overwrite file if destination file already exists?
  *
  * @return boolean
  * @throws CEFileSystemError {@link CEFileSystemError description}
  * @throws CEUploadError {@link CEUploadError description}
  *
  * @access public
  */
 public function save($dest = null, $genFname = false, $overwrite = false)
 {
     if (is_null($dest)) {
         $dest = $this->saveDir;
     }
     $dest = realpath($dest);
     if ('' == $dest || !is_writeable($dest)) {
         throw new CEFileSystemError(sprintf('Cannot write to "%s" ' . 'directory.', $dest), 301);
     }
     if ($genFname) {
         $fname = $this->generateFname();
     } else {
         $fname = $this->name;
     }
     $path = Path::join($dest, $fname);
     if (is_file($path)) {
         if ($overwrite) {
             unlink($path);
         } else {
             throw new CEFileSystemError(sprintf('File "%s" already ' . 'exists.', $path), 302);
         }
     }
     $preSave = $this->preSave();
     if (!is_null($preSave)) {
         throw new CEUploadError($preSave[0], $preSave[1]);
     }
     if (isset($_SESSION[$this->sessionName][$this->fieldName])) {
         unset($_SESSION[$this->sessionName][$this->fieldName]);
     }
     $ret = rename($this->tmpName, $path);
     $postSave = $this->postSave();
     if (!is_null($postSave)) {
         throw new CEUploadError($postSave[0], $postSave[1]);
     }
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:53,代码来源:class_upload.php

示例14: searchFiles

 function searchFiles($name, $content)
 {
     $folders = [];
     $foundFiles = [];
     foreach ($this->getItemArray() as $item) {
         if ($item instanceof Folder) {
             $folders[] = $item;
         } elseif ($item instanceof File) {
             $nameMatched = true;
             if ($name) {
                 $nameMatched = false;
                 if (strpos($item->name, $name) !== false) {
                     $nameMatched = true;
                 }
             }
             $contentMatched = true;
             if ($content) {
                 $contentMatched = false;
                 $contentJson = $item->getContent();
                 $fileContent = $contentJson['content'];
                 if (strpos($fileContent, $content) !== false) {
                     $contentMatched = true;
                 }
             }
             if ($nameMatched && $contentMatched) {
                 $file = $item->toClientJson();
                 $file['path'] = $file['name'];
                 $foundFiles[] = $file;
             }
         }
     }
     // find files in subfolders
     foreach ($folders as $folder) {
         $subfiles = $folder->searchFiles($name, $content);
         foreach ($subfiles as &$subfile) {
             $subfile['path'] = Path::join([$folder->name, $subfile['path']]);
         }
         $foundFiles = array_merge($foundFiles, $subfiles);
     }
     return $foundFiles;
 }
开发者ID:ufosky-server,项目名称:Gvirila,代码行数:41,代码来源:Folder.php


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