function deleteFile() { $upyun = new UpYun($this->bucket, 'user', 'pwd'); $upyun->deleteFile($filePath); }
public function deleteFile($filepath) { $upyun = new UpYun($this->user['extend']['bucket_name']['value'], SPACEOPERATORS, SPACEOPERATORSPASSWORD); //file_put_contents(CACHE_DIR . 'delete.txt', var_export($this->input,1), FILE_APPEND); try { $result = $upyun->deleteFile($filepath); ///$this->addItem_withkey('error', 0); return true; } catch (Exception $e) { //$this->addItem_withkey('error', '1'); return false; } }
/** * 删除文件 * @access public * @param string $filename 文件相对路径 * @return bool */ public function deleteFile($filename) { //上传到云服务器 $config = $this->getConfig(); tsload(ADDON_PATH . '/library/upyun.class.php'); $cloud = new UpYun($config['cloud_image_bucket'], $config['cloud_image_admin'], $config['cloud_image_password']); $cloud->setTimeout(60); $res = $cloud->deleteFile($filename); if (!$res) { $this->error = '删除云服务器文件失败!'; return false; } else { return true; } }