本文整理汇总了PHP中DB::close方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::close方法的具体用法?PHP DB::close怎么用?PHP DB::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: yg_shutdown
function yg_shutdown()
{
DB::close();
fire_hook('shutdown');
}
示例2: disconnectDB
/**
* Close the DB connection.
*/
protected function disconnectDB()
{
if (isset($this->db)) {
$this->db->close();
$this->db = null;
}
}
示例3: __shutdown
/**
* Feng Office shutdown function
*
* @param void
* @return null
*/
function __shutdown() {
DB::close();
$logger_session = Logger::getSession();
if(($logger_session instanceof Logger_Session) && !$logger_session->isEmpty()) {
Logger::saveSession();
} // if
} // __shutdown
示例4: query
/**
* Make a sql query to the database.
*
* @param string $sql
* @return integer
*/
public static function query($sql)
{
DB::connect();
$res = mysqli_query(DB::$connection, $sql);
DB::close();
return $res;
}
示例5: close
/**
* Close the session
* @return bool
*/
function close()
{
$this->gc();
DB::close();
//close database-connection
return true;
}
示例6: __destruct
/**
* 销毁
*/
public function __destruct()
{
global $_M;
DB::close();
//关闭数据库连接
exit;
}
示例7: run
function run()
{
DB::connect();
//determin controller
switch ($_GET['ctrl']) {
case 'page':
$ctrl = new PageController();
break;
case 'wine':
$ctrl = new WineController();
break;
case 'response':
$ctrl = new ResponseController();
break;
case 'report':
$ctrl = new ReportController();
break;
case 'dp':
$ctrl = new DianPingController();
break;
default:
$ctrl = new PageController();
}
return $ctrl->dispatch($_GET['action'] . "Action");
DB::close();
}
示例8: sendError
public static function sendError($error = 1)
{
header('HTTP/1.1 500 Internal Server Error');
//header('Content-Type: application/json; charset=UTF-8');
DB::close();
User::destroySession();
exit(self::encodeError($error));
}
示例9: end
public function end()
{
if ($this->isAlreadyOpened === TRUE) {
$this->endTransaction();
$this->DB->close();
}
unset($this->DB);
$this->isAlreadyOpened = FALSE;
}
示例10: newUser
private function newUser()
{
$db = new DB();
$query = 'INSERT INTO mototimes_users (id_vk, name, role) VALUES(?,"new user","standart")';
$stmt = $db->prepare($query);
$stmt->bind_param('i', $this->get('userid'));
$stmt->execute();
$db->close();
}
示例11: drawTemplate
public static function drawTemplate()
{
DB::close();
self::saveContentCurrentBox();
ob_get_flush();
if (function_exists('gz_handler')) {
ob_start("gz_handler");
}
include_once './template/' . self::$template . '/template.php';
}
示例12: execute
public function execute()
{
$db = new DB();
if ($db->connect_errno) {
$this->result = ErrorBuilder::dbError($db->connect_error);
return;
}
$query = '
SELECT
id,
UNIX_TIMESTAMP(created) AS created,
lat,
lng AS lon,
karma,
alignment,
CASE transport
WHEN 1 THEN "GS"
WHEN 2 THEN "RT"
WHEN 3 THEN "CAR"
ELSE "GS"
END AS type,
`text`
FROM
mototimes_events
WHERE
UNIX_TIMESTAMP() - UNIX_TIMESTAMP(created) < 14400 + karma*60
AND transport IN (1,2,3)
UNION ALL
SELECT
id,
0 AS created,
lat,
lon,
0 AS karma,
0 AS alignment,
type,
`text`
FROM
objects
WHERE `stop` IS NULL OR `stop`>CURRENT_TIMESTAMP()
';
$result = $db->query($query);
if ($db->errno !== 0) {
$this->result = ErrorBuilder::dbError($db->error);
return;
}
$list = array();
while ($row = $result->fetch_assoc()) {
$list[] = array('id' => (int) $row['id'], 'created' => (int) $row['created'], 'lat' => (double) $row['lat'], 'lon' => (double) $row['lon'], 'karma' => (int) $row['karma'], 'alignment' => (int) $row['alignment'], 'type' => $row['type'], 'text' => $row['text']);
}
$db->close();
$this->result = array("error" => "OK", "data" => $list);
}
示例13: getFromEnglish
static function getFromEnglish($english)
{
$mysqli = DB::getConn();
$sql = "select * from english where english='{$english}'";
$result = DB::getResult($sql, $mysqli);
$arr = array();
while ($array = $result->fetch_assoc()) {
$arr[] = $array;
}
DB::close($mysqli, null, $result);
return $arr;
}
示例14: vote
function vote()
{
if (isset($_GET['dir']) && isset($_GET['did'])) {
$d = new Diff();
if ($d->populateDiff($_GET['did'])) {
if ($_GET['dir'] == 1 || $_GET['dir'] == -1) {
$db = new DB();
$db->query("SELECT * FROM `rating` WHERE `did` = '{$_GET['did']}' AND `uid` = '{$_SESSION['uid']}';");
if ($db->numRows() == 0) {
$db->query("INSERT INTO `rating` (`did`, `uid`, `rating`) VALUES ('{$_GET['did']}', '{$_SESSION['uid']}', '{$_GET['dir']}');");
} else {
$db->query("UPDATE `rating` SET `rating` = '{$_GET['dir']}' WHERE `did` = '{$_GET['did']}' AND `uid` = '{$_SESSION['uid']}';");
}
$db->close();
}
}
}
}
示例15: Document
function Document($row)
{
Module::Module($row);
$cmd = Url::get('cmd');
require_once "forms/DocumentList.php";
switch ($cmd) {
case 'delete':
$this->add_form(new Deletedocument());
break;
case 'change':
$this->add_form(new PublicdocumentForm());
break;
default:
$id = (int) Url::get('id');
$azname = trim(URL::get("azname", ''));
if ($id || $azname != '') {
if ($id && $azname != '') {
$document = DB::select("document", "id={$id}");
if ($document && $azname == AZLib::safe_title($document['title']) && $document['file_path']) {
$file_src = DATA_PATH . "document/{$document['file_path']}";
if (file_exists(ROOT_PATH . $file_src)) {
$ext = AZLib::getExtension($file_src);
if ($ext && strlen($ext) <= 5) {
$ext_app = substr($ext, 1);
if ($document['status'] == 1 || User::haveAnyPermission(ADMIN_DOCUMENT)) {
DB::query("UPDATE document SET down_num=down_num+1, time_last=" . TIME_NOW . " WHERE id={$id}");
DB::close();
header("Content-type: application/{$ext_app}");
header("Content-Disposition: attachment; filename=" . date("Y.m.d-H\\hi", $document['time_m']) . "-{$id}-{$azname}{$ext}");
readfile(ROOT_PATH . $file_src);
exit;
}
}
}
}
}
header("HTTP/1.0 404 Not Found");
echo "<h1>404 - Not Found!<br />Return to <a href='" . WEB_ROOT . "'>" . WEB_NAME . "</a></h1>";
exit;
}
$this->add_form(new ListdocumentForm());
break;
}
}