本文整理汇总了PHP中Folder::path方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::path方法的具体用法?PHP Folder::path怎么用?PHP Folder::path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::path方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _zipDir
private static function _zipDir(Folder $dir, \ZipArchive $zip, $relative_path)
{
$items = $dir->ls();
if (count($items)) {
foreach ($items as $item) {
if ($item->isFile()) {
$name = $relative_path . $item->name();
$name = @iconv('UTF-8', 'CP850//TRANSLIT', $name);
\GO::debug("Add file: " . $name);
$zip->addFile($dir->path() . '/' . $item->name(), $name);
} else {
self::_zipDir($item, $zip, $relative_path . $item->name() . '/');
}
}
} else {
\GO::debug("Add empty dir: " . $relative_path);
if (!$zip->addEmptyDir(rtrim($relative_path, '/'))) {
throw new \Exception("Could not add emty directory " . $relative_path);
}
}
}
示例2: moveUploadedFiles
/**
*
* @param array $uploadedFileArray
* @param Folder $destinationFolder
* @param boolean $overwrite If false this function will append a number. eg. Filename (1).jpg
* @return File[]
*/
public static function moveUploadedFiles($uploadedFileArray, $destinationFolder, $overwrite = false)
{
if (!is_array($uploadedFileArray['tmp_name'])) {
$uploadedFileArray['tmp_name'] = array($uploadedFileArray['tmp_name']);
$uploadedFileArray['name'] = array($uploadedFileArray['name']);
}
$files = array();
for ($i = 0; $i < count($uploadedFileArray['tmp_name']); $i++) {
if (is_uploaded_file($uploadedFileArray['tmp_name'][$i])) {
$destinationFile = new File($destinationFolder->path() . '/' . $uploadedFileArray['name'][$i]);
if (!$overwrite) {
$destinationFile->appendNumberToNameIfExists();
}
if (move_uploaded_file($uploadedFileArray['tmp_name'][$i], $destinationFile->path())) {
$destinationFile->setDefaultPermissions();
$files[] = $destinationFile;
}
}
}
return $files;
}
示例3: rss
public function rss()
{
setlocale(LC_ALL, 'en_US');
$limit = 10;
$ret = array();
foreach ($this->folder->subFolders as $s) {
$path = Folder::path($s);
$uri = $path . '/last/' . $limit;
$ret += Ctrl::fetchData($uri);
}
krsort($ret);
return array_splice($ret, 0, $limit);
}
示例4: createLink
/**
* Create a symbolic link in this folder
*
* @param Folder $target
* @param string $linkName optional link name. If omitted the name will be the same as the target folder name
* @return File
* @throws Exception
*/
public function createLink(Folder $target, $linkName = null)
{
if (!isset($linkName)) {
$linkName = $target->name();
}
$link = $this->createChild($linkName, true);
if ($link->exists()) {
throw new \Exception("Path " . $link->path() . " already exists");
}
if (symlink($target->path(), $link->path())) {
return $link;
} else {
throw new \Exception("Failed to create link " . $link->path() . " to " . $target->path());
}
}