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


PHP FileSystem::initializeFTP方法代码示例

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


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

示例1: copy

	/**
	 * Copy a file to a destination.
	 *
	 * After executing this method successfully, this object will not point to the new file!
	 * If the specified destination does not exist this function returns false.
	 *
	 * This function implements the ftp fallback!
	 *
	 * @param string Destination path
	 * @return bool Returns true on success, false on failure
	 */
	public function copy($dest) {
		if ($this->exists() == false) {
			return false;
		}

		if (copy($this->path, $dest) == true) {
			return true;
		}
		elseif ($this->ftp == true) {
			$fp = fopen($this->path, "r");
			$ftp = FileSystem::initializeFTP();
			if (is_resource($fp) == true && $ftp !== null) {
				$ret = $ftp->put($fp, $this->ftpizePath($dest));
				fclose($fp);
				return $ret;
			}
		}
		return false;
	}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:30,代码来源:class.File.php

示例2: move

	/**
	 * Attempts to move the file/folder to the specified path.
	 *
	 * After executing this method successfully, this object will point to the new file/folder!
	 * To just rename a file/folder please consider using the FileSystemNode::rename() function.
	 * If there is already a file/folder with the name specified as parameter nothing will be done
	 * and false will be returned.
	 *
	 * This function implements the ftp fallback!
	 *
	 * @see Folder::rename()
	 * @see File::rename()
	 * @param string Path to the new location.
	 * @return boolean Returns TRUE on success or FALSE on failure.
	 */
	public function move($dest) {
		if ($this->exists() == false || file_exists($dest) == true) {
			return false;
		}

		if (rename($this->path, $dest) == true) {
			$this->path = $dest;
			return true;
		}
		elseif ($this->ftp == true) {
			$ftp = FileSystem::initializeFTP();
			if ($ftp !== null && $ftp->rename($this->ftpPath(), $this->ftpize($dest)) === true) {
				$this->path = $dest;
				return true;
			}
		}
		return false;
	}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:33,代码来源:class.FileSystemNode.php

示例3: delete

	/**
	 * Deletes the folder completely with all contents.
	 *
	 * Does nothing when the folder does not exist and returns true.
	 *
	 * This function implements the ftp fallback!
	 *
	 * @return boolean Returns TRUE on success or FALSE on failure.
	 */
	public function delete() {
		if ($this->exists() == false) {
			return true;
		}

		// Remove the content
		$clear = $this->clear();
		if ($clear == true && rmdir($this->path) == true) {
			return true;
		}
		elseif ($clear == true && $this->ftp == true) {
			$ftp = FileSystem::initializeFTP();
			if ($ftp !== null) {
				return $ftp->rmdir($this->ftpPath());
			}
		}
		return false;
	}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:27,代码来源:class.Folder.php


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