本文整理匯總了PHP中Symfony\Component\HttpFoundation\File\File::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::delete方法的具體用法?PHP File::delete怎麽用?PHP File::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\HttpFoundation\File\File
的用法示例。
在下文中一共展示了File::delete方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteElement
function deleteElement($id)
{
$wholeTree = Input::get("wt");
$baseElement = SkinElement::find($id);
$skin = Skin::find($baseElement->skin_id);
if (!isset($baseElement)) {
return Response::json('fail');
}
if (Auth::user()->id != $skin->user_id) {
throw new AccessDeniedException();
}
if ($wholeTree == "true") {
$elementsToRemove = SkinElement::where("skin_id", $skin->id)->where("filename", $baseElement->filename)->where("ishd", $baseElement->ishd)->get();
foreach ($elementsToRemove as $el) {
File::delete(public_path() . "/skins-content/" . $el->skin->id . "/" . $el->getFullname());
$skin->size -= $el->size;
$el->delete();
}
$skin->save();
return Response::json('success');
} else {
File::delete(public_path() . "/skins-content/" . $baseElement->skin->id . "/" . $baseElement->getFullname());
$skin->size -= $baseElement->size;
$skin->save();
$baseElement->delete();
return Response::json('success');
}
}