public static function delete($file)
{
if (empty($file)) {
return false;
}
if (function_exists('option')) {
$bucket = option('config.attachment_up_bucket');
$user = option('config.attachment_up_username');
$pwd = option('config.attachment_up_password');
$unlink = option('config.attachment_upload_unlink');
} else {
$bucket = C('config.attachment_up_bucket');
$user = C('config.attachment_up_username');
$pwd = C('config.attachment_up_password');
$unlink = C('config.attachment_upload_unlink');
}
if (empty($bucket) || empty($user) || empty($pwd)) {
return false;
}
if (empty($unlink)) {
return false;
}
$upyun = new UpYun($bucket, $user, $pwd);
try {
error_log('upyunUser::delete:' . $file);
$upyun->delete($file);
} catch (Exception $e) {
print_r($e);
}
}