本文整理汇总了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;
}
示例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);
}
示例3: onBeforeDelete
public function onBeforeDelete()
{
parent::onBeforeDelete();
foreach ($this->Providers() as $Provider) {
$Provider_ > delete();
}
}
示例4: deleteCallsDestructor
public function deleteCallsDestructor()
{
$hash = $this->destroyable->hashCode();
delete($this->destroyable);
$this->assertNull($this->destroyable);
$this->assertEquals(1, $this->destroyed[$hash]);
}
示例5: test
/**
* Test.
*/
public function test()
{
// Should raise a warning
delete();
// Should not raise a warning
$this->_utilisateur->delete();
}
示例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;
}
}
}
示例7: delete
public function delete()
{
with($stream = new FileOutputStream($this->file));
$this->assertTrue($this->file->isOpen());
delete($stream);
$this->assertTrue($this->file->isOpen());
}
示例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();
}
}
示例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);
}
示例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;
}
示例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;
}
示例12: deleteListName
function deleteListName($id)
{
if (delete("booklistname", "id={$id}")) {
$mes = true;
} else {
$mes = false;
}
return $mes;
}
示例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;
}
示例14: delall
public function delall()
{
$result = M('PluginSeokeyword')->where('1=1') > delete();
if ($result > 0) {
$this->success('清空成功');
} else {
$this->error('清空失败');
}
}
示例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;
}