當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Images::deleteImage方法代碼示例

本文整理匯總了PHP中Images::deleteImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Images::deleteImage方法的具體用法?PHP Images::deleteImage怎麽用?PHP Images::deleteImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Images的用法示例。


在下文中一共展示了Images::deleteImage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: header

//Check if user is logged in and trying to delete their own image
require_once './includes/session_timeout.php';
require_once './includes/dbcon.php';
if (!isset($_SESSION['username'])) {
    header("Location: login.php");
    die;
}
if (!isset($_GET["id"])) {
    header("Location: index.php");
    die;
}
$id = $_GET["id"];
$userID = $_SESSION['userID'];
require_once './includes/Images/Images.php';
$dbImages = new Images($conn);
$image = $dbImages->getImage($id);
if ($image[5] != $userID) {
    header("Location: userpage.php");
    die;
}
//Safe to delete
unlink("./img/thumbs/thumb_{$image[2]}");
unlink("./img/large/{$image[2]}");
$result = $dbImages->deleteImage($id);
if ($result) {
    header("Location: userpage.php");
    die;
} else {
    echo "Eitthvað bilaði. <a href='userpage.php'>Til baka?</a>";
}
開發者ID:GudniNatan,項目名稱:Myndavefur-VEF2A3U,代碼行數:30,代碼來源:deleteimage.php

示例2: Images

 $images = new Images();
 $response = setResponse($response, $api_response_code, 1);
 switch ($_SERVER['REQUEST_METHOD']) {
     case 'POST':
         $response['data'] = $images->postImage($_POST);
         $success = true;
         break;
     case 'PUT':
         if (!empty($action)) {
             $response['data'] = $images->setActive($action);
             $success = true;
         }
         break;
     case 'DELETE':
         if (!empty($action)) {
             $response['data'] = $images->deleteImage($action);
             $success = true;
         }
         break;
     case 'GET':
         if ($action == "search") {
             $response['data'] = $images->getImage($_GET['user']);
             $success = true;
         }
         if ($action == null) {
             $response['data'] = $images->getImages();
             $success = true;
         }
         break;
     default:
         break;
開發者ID:marcteys,項目名稱:pixebble,代碼行數:31,代碼來源:index.php


注:本文中的Images::deleteImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。