本文整理汇总了PHP中Data::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::delete方法的具体用法?PHP Data::delete怎么用?PHP Data::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: erase
public function erase($key = null)
{
if (null === $key) {
$delete = parent::delete('thinsession', $this->_session->getId());
return new self($this->_sessionName);
} else {
$data = $this->_session->getData();
$data->{$key} = null;
return $this->save();
}
}
示例2: forget
/**
* Delete an item from the cache.
*
* @param string $key
* @return void
*/
public function forget($key)
{
$this->_cleanCache();
$res = Data::query('cache', 'key = ' . $key . ' && namespace = ' . $this->namespace);
if (count($res)) {
$obj = Data::getObject(current($res));
$del = Data::delete('cache', $obj->getId());
}
}
示例3: Config
<?php
// check if value was posted
// include database and object file
include_once 'includes/config.php';
include_once 'includes/data.inc.php';
// get database connection
$database = new Config();
$db = $database->getConnection();
// prepare product object
$product = new Data($db);
// set product id to be deleted
$product->id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: missing ID.');
// delete the product
if ($product->delete()) {
echo "<script>location.href='index.php'</script>";
} else {
echo "<script>alert('Gagal menghapus data')</script>";
}
示例4: delete
/**
* Get a DELETE variable in the request.
*
* @param string $k The key.
*
* @return string
*/
public function delete($k = null)
{
return \Data::delete($k);
}
示例5: deleteTied
private function deleteTied($exemplars)
{
if (is_object($exemplars)) {
$exemplars = [$exemplars];
}
$result = true;
foreach ($exemplars as $exemplar) {
foreach ($this->ties as $tie) {
if (!isset($exemplar->{$tie->key})) {
throw new \Exception("Key doesn't exists in exemplar");
}
$tie->ids = $exemplar->{$tie->key};
$criterion = ['where' => ['query' => "`{$this->table}_{$this->primary_field}`=?", 'vars' => $tie->ids]];
$TieData = new Data($this->Db, $tie->name);
$result = $TieData->delete($criterion, $tie->deletion_type);
}
}
return $result;
}