当前位置: 首页>>代码示例>>PHP>>正文


PHP delete函数代码示例

本文整理汇总了PHP中delete函数的典型用法代码示例。如果您正苦于以下问题:PHP delete函数的具体用法?PHP delete怎么用?PHP delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delUser

function delUser($id)
{
    $where = "id={$id}";
    $totalCap = getCityCapById(getcIdById($id)) - getCapById($id);
    $sql = "update biogas_city set totalCap=" . $totalCap . " where id=" . getcIdById($id);
    mysql_query($sql);
    //更新城市的总池容
    $res = delete("biogas_user", $where);
    $userImgs = getAllImgByUserId($id);
    if ($userImgs && is_array($userImgs)) {
        foreach ($userImgs as $userImg) {
            if (file_exists("../uploads/" . $userImg['albumPath'])) {
                unlink("../uploads/" . $userImg['albumPath']);
            }
        }
    }
    $where1 = "uid={$id}";
    if ($userImgs && is_array($userImgs)) {
        $res1 = delete("biogas_album", $where1);
        if ($res && $res1) {
            $mes = "删除成功!<br/><a href='listUser.php' target='mainFrame'>查看用户列表</a>";
        } else {
            $mes = "删除失败!<br/><a href='listUser.php' target='mainFrame'>重新删除</a>";
        }
    } else {
        if ($res) {
            $mes = "删除成功!<br/><a href='listUser.php' target='mainFrame'>查看用户列表</a>";
        } else {
            $mes = "删除失败!<br/><a href='listUser.php' target='mainFrame'>重新删除</a>";
        }
    }
    return $mes;
}
开发者ID:BigeyeDestroyer,项目名称:biogas,代码行数:33,代码来源:user.inc.php

示例2: applyOn

 /**
  * Apply this filter on a given image. Note: This changes the given image!
  *
  * @param   img.Image image
  * @return  bool
  * @throws  img.ImagingException
  */
 public function applyOn($image)
 {
     $clone = clone $image;
     // Create local variables for faster access
     $chandle = $clone->handle;
     $ihandle = $image->handle;
     $w = $image->getWidth() - 1;
     $h = $image->getHeight() - 1;
     for ($y = 1; $y < $h; ++$y) {
         $rgb_y0 = imagecolorat($chandle, 0, $y);
         $rd = $rgb_y0 >> 0x10;
         $gd = $rgb_y0 >> 0x8 & 0xff;
         $bd = $rgb_y0 & 0xff;
         for ($yd = $y - 1, $yi = $y + 1, $x = 1; $x < $w; ++$x) {
             $rgb_xy = imagecolorat($chandle, $x, $y);
             $rgb_xyi = imagecolorat($chandle, $x, $yi);
             $rgb_xiy = imagecolorat($chandle, $x + 1, $y);
             $rgb_xyd = imagecolorat($chandle, $x, $yd);
             $nr = -(($rgb_xyd >> 0x10) + ($rgb_xyi >> 0x10) + $rd + ($rgb_xiy >> 0x10)) / 4;
             $ng = -(($rgb_xyd >> 0x8 & 0xff) + ($rgb_xyi >> 0x8 & 0xff) + $gd + ($rgb_xiy >> 0x8 & 0xff)) / 4;
             $nb = -(($rgb_xyd & 0xff) + ($rgb_xyi & 0xff) + $bd + ($rgb_xiy & 0xff)) / 4;
             $nr += 2 * ($rd = $rgb_xy >> 0x10);
             $ng += 2 * ($gd = $rgb_xy >> 0x8 & 0xff);
             $nb += 2 * ($bd = $rgb_xy & 0xff);
             // Normalize
             $nr = $nr > 255.0 ? 255.0 : ($nr < 0.0 ? 0.0 : $nr);
             $ng = $ng > 255.0 ? 255.0 : ($ng < 0.0 ? 0.0 : $ng);
             $nb = $nb > 255.0 ? 255.0 : ($nb < 0.0 ? 0.0 : $nb);
             imagesetpixel($ihandle, $x, $y, $nr << 0x10 | $ng << 0x8 | $nb);
         }
     }
     delete($clone);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:40,代码来源:SharpenFilter.class.php

示例3: onBeforeDelete

 public function onBeforeDelete()
 {
     parent::onBeforeDelete();
     foreach ($this->Providers() as $Provider) {
         $Provider_ > delete();
     }
 }
开发者ID:andrelohmann,项目名称:vagrant-cloud,代码行数:7,代码来源:BoxVersion.php

示例4: deleteCallsDestructor

 public function deleteCallsDestructor()
 {
     $hash = $this->destroyable->hashCode();
     delete($this->destroyable);
     $this->assertNull($this->destroyable);
     $this->assertEquals(1, $this->destroyed[$hash]);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:7,代码来源:DestructorTest.class.php

示例5: test

 /**
  * Test.
  */
 public function test()
 {
     // Should raise a warning
     delete();
     // Should not raise a warning
     $this->_utilisateur->delete();
 }
开发者ID:Erseni,项目名称:phpcheckstyle,代码行数:10,代码来源:issue73.php

示例6: delete

function delete($path)
{
    $directory = $path;
    if (is_file($directory)) {
        // its a file, remove it!
        @unlink($directory);
    } else {
        if (substr($directory, -1) == "/") {
            $directory = substr($directory, 0, -1);
        }
        if (!file_exists($directory) || !is_dir($directory)) {
            return false;
        } elseif (!is_readable($directory)) {
            return false;
        } else {
            $directoryHandle = opendir($directory);
            while ($contents = readdir($directoryHandle)) {
                if ($contents != '.' && $contents != '..') {
                    $path = $directory . "/" . $contents;
                    if (is_dir($path)) {
                        delete($path);
                    } else {
                        unlink($path);
                    }
                }
            }
            closedir($directoryHandle);
            if (!rmdir($directory)) {
                return false;
            }
            return true;
        }
    }
}
开发者ID:ZerGabriel,项目名称:misc-repohelper,代码行数:34,代码来源:helper.php

示例7: delete

 public function delete()
 {
     with($stream = new FileOutputStream($this->file));
     $this->assertTrue($this->file->isOpen());
     delete($stream);
     $this->assertTrue($this->file->isOpen());
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:7,代码来源:FileOutputStreamTest.class.php

示例8: main

function main() {

    global $auth;

    if ($_REQUEST['action'] == 'delete' && $auth){
        delete();
    }
    elseif ($_REQUEST['action'] == 'list' && $auth){
        view_list();
    }
    elseif ($_REQUEST['action'] == 'banip' && $auth){
        banip();
    }
    elseif ($_REQUEST['action'] == 'search' && $auth){
        search();
    }
    elseif ($_REQUEST['action'] == 'bannedlist' && $auth){
        bannedlist();
    }
    elseif ($_REQUEST['action'] == 'unbanip' && $auth){
        unbanip();
    }
    elseif ($_REQUEST['action'] == 'logout'){
        logout();
    }
    elseif (1) {
        login_screen();
    }

}
开发者ID:neutyp,项目名称:commenter,代码行数:30,代码来源:admin.php

示例9: daoDeleteArticle

function daoDeleteArticle($articleid)
{
    //$query = "DELETE FROM articles WHERE articleid = " . $articleid . ";";
    // Safe delete - doesn't actually remove anything from the DB
    $query = "UPDATE articles SET is_deleted = 1 WHERE articleid = " . $articleid . ";";
    return delete($query);
}
开发者ID:arewold,项目名称:calcuttagutta,代码行数:7,代码来源:articledao.php

示例10: import_zip

/**
 * Import content
 *
 * @param string $file
 *
 * @return bool
 */
function import_zip(string $file) : bool
{
    $path = path('tmp', uniqid('import', true));
    if (file_exists($path)) {
        file_delete($path);
    }
    try {
        unzip($file, $path);
    } catch (Exception $e) {
        message($e->getMessage());
        return false;
    }
    if (!($toc = file_one($path, ['name' => data('import', 'toc'), 'recursive' => true]))) {
        message(_('File %s not found', data('import', 'toc')));
        return false;
    }
    // Copy media files
    file_copy($toc['dir'] . '/media', project_path('media'));
    $trans = trans(function () use($toc) {
        $import = csv_unserialize(file_get_contents($toc['path']), ['keys' => ['pos', 'name', 'file']]);
        // Delete old menu, nodes and pages + create new menu
        $menu = [-1 => ['uid' => 'page', 'name' => 'Page']];
        if (!delete('page') || !delete('menu', ['uid' => 'page']) || !save('menu', $menu)) {
            throw new RuntimeException(_('Import error'));
        }
        // Create new contents
        $levels = [0];
        $base = url();
        $oids = [];
        foreach ($import as $item) {
            $oid = pathinfo($item['file'], PATHINFO_FILENAME);
            if (empty($oids[$oid])) {
                $pages = [];
                $pages[-1]['name'] = $item['name'];
                $pages[-1]['active'] = true;
                $pages[-1]['content'] = $item['file'] ? import_content($toc['dir'] . '/' . $item['file']) : null;
                if (!save('page', $pages)) {
                    throw new RuntimeException(_('Import error'));
                }
                $oids[$oid] = $pages[-1]['id'];
            }
            $level = substr_count($item['pos'], '.');
            $basis = !empty($levels[$level - 1]) ? $levels[$level - 1] : 0;
            $nodes = [];
            $nodes[-1]['name'] = $item['name'];
            $nodes[-1]['target'] = $base . 'page/view/' . $oids[$oid];
            $nodes[-1]['mode'] = 'child';
            $nodes[-1]['position'] = $menu[-1]['id'] . ':' . $basis;
            if (!save('node', $nodes)) {
                throw new RuntimeException(_('Import error'));
            }
            $levels[$level] = $nodes[-1]['lft'];
        }
        if (!in_array('index', $oids) && ($p = glob($toc['dir'] . '/index.{html,odt}', GLOB_BRACE)) && !import_page($p[0])) {
            throw new RuntimeException(_('Import error'));
        }
    });
    file_delete($path);
    return $trans;
}
开发者ID:akilli,项目名称:qnd,代码行数:67,代码来源:import.php

示例11: delCate

/**
 * 删除类别
 * @param int $id
 * @return string
 */
function delCate($id)
{
    if (delete("imooc_cate", "id={$id}")) {
        $mes = "删除成功!<a href='listCate.php'>查看类别列表</a>";
    } else {
        $mes = "删除失败!<a href='listCate.php'>重新删除</a>";
    }
    return $mes;
}
开发者ID:hiden2,项目名称:shopImooc-1,代码行数:14,代码来源:cate.inc.php

示例12: deleteListName

function deleteListName($id)
{
    if (delete("booklistname", "id={$id}")) {
        $mes = true;
    } else {
        $mes = false;
    }
    return $mes;
}
开发者ID:kunkuntang,项目名称:xingHelper,代码行数:9,代码来源:bookListAction.php

示例13: delCate

function delCate($where)
{
    if (delete('imooc_cate', $where)) {
        $mes = "分类删除成功!<br/><a href='listCate.php'>查看分类列表</a>|<a href='addCate.php'>添加分类</a>";
    } else {
        $mes = "分类删除失败!<br/><a href='listCate.php'>请重新操作</a>";
    }
    return $mes;
}
开发者ID:yangdc,项目名称:mooc,代码行数:9,代码来源:cate.inc.php

示例14: delall

 public function delall()
 {
     $result = M('PluginSeokeyword')->where('1=1') > delete();
     if ($result > 0) {
         $this->success('清空成功');
     } else {
         $this->error('清空失败');
     }
 }
开发者ID:735579768,项目名称:Ainiku,代码行数:9,代码来源:SeokeywordPlugin.class.php

示例15: cancelApply

function cancelApply($id)
{
    if (delete("apply", "id={$id}")) {
        $mes = "取消申请成功!<br/><a href='listApply.php'>查看申请列表</a>";
    } else {
        $mes = "取消申请失败!<br/><a href='listApply.php'>请重新操作</a>";
    }
    return $mes;
}
开发者ID:qiancs1101,项目名称:Recommend-Purchase,代码行数:9,代码来源:user.inc.php


注:本文中的delete函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。