本文整理汇总了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;
}
示例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;
}
示例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;
}