本文整理汇总了PHP中object::close方法的典型用法代码示例。如果您正苦于以下问题:PHP object::close方法的具体用法?PHP object::close怎么用?PHP object::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: close
/**
* {@inheritdoc}
*/
public function close()
{
if ($this->dbHandle) {
$this->dbHandle->close();
$this->dbHandle = null;
}
}
示例2: __destruct
/**
* 析构函数
*/
public function __destruct()
{
if ($this->isConnected) {
$this->mem->close();
}
$this->mem = NULL;
}
示例3: clear
/**
* Delete all values from the cache
*
* @param boolean $check Optional - only delete expired cache items
* @return boolean True if the cache was succesfully cleared, false otherwise
* @access public
*/
function clear($check)
{
if (!$this->__init) {
return false;
}
$dir = dir($this->settings['path']);
if ($check) {
$now = time();
$threshold = $now - $this->settings['duration'];
}
while (($entry = $dir->read()) !== false) {
if ($this->__setKey($entry) === false) {
continue;
}
if ($check) {
$mtime = $this->__File->lastChange();
if ($mtime === false || $mtime > $threshold) {
continue;
}
$expires = $this->__File->read(11);
$this->__File->close();
if ($expires > $now) {
continue;
}
}
$this->__File->delete();
}
$dir->close();
return true;
}
示例4: close
/**
* Close the zip archive
*
* @return bool
* @throws \Comodojo\Exception\ZipException
*/
public function close()
{
if ($this->zip_archive->close() === false) {
throw new ZipException(self::getStatus($this->zip_archive->status));
}
return true;
}
示例5: closeMysql
/**
* Close connection if it exists
*
* @author KnowledgeTree Team
* @access private
* @params mysql connection object $con
* @return void
*/
private function closeMysql($con)
{
try {
$this->_dbhandler->close();
} catch (Exeption $e) {
$this->error['con'] = "Could not close: " . $e;
}
}
示例6: __destruct
/**
* Class destructor
*
* Closes the connection to Memcache(d) if present.
*
* @return void
*/
public function __destruct()
{
if ($this->_memcached instanceof Memcache) {
$this->_memcached->close();
} elseif ($this->_memcached instanceof Memcached && method_exists($this->_memcached, 'quit')) {
$this->_memcached->quit();
}
}
示例7: __destruct
/**
* Class destructor
*
* Closes the connection to Memcache(d) if present.
*
* @return void
*/
public function __destruct()
{
if ($this->_memcached instanceof Memcache) {
$this->_memcached->close();
} elseif ($this->_memcached instanceof Memcached) {
$this->_memcached->quit();
}
}
示例8: closeConnection
/**
* Closes a previously opened database connection
*/
public function closeConnection()
{
if ($this->debug) {
$this->debug->log(__METHOD__);
}
$this->isConnected() && $this->DB->close();
$this->DB = null;
}
示例9: close
/**
* 关闭数据库连接
*
* @return void
*/
public function close()
{
$this->_driver->close($this->_writeConnection);
$this->_writeConnection = null;
if (!empty($this->_readConnection)) {
$this->_driver->close($this->_readConnection);
$this->_readConnection = null;
}
}
示例10: disconnect
/**
* Disconnect from the Mongo server.
*
* @return boolean True on successful disconnect, false otherwise.
*/
public function disconnect() {
if ($this->server && $this->server->connected) {
try {
$this->_isConnected = !$this->server->close();
} catch (Exception $e) {}
unset($this->connection, $this->server);
return !$this->_isConnected;
}
return true;
}
示例11: __deconstruct
/**
* Deconstructor
*
* Close connections to the database
* @since Version 3.7
*/
protected function __deconstruct()
{
if ($this->destroy) {
if ($this->db instanceof \sql_db) {
$this->db->close();
} else {
#$this->closeConnection();
}
}
}
示例12: __destruct
/**
* 析构函数
*
* 程序执行完毕,打扫战场
*
* @access public
*
* @return void
*/
public function __destruct()
{
if ($this->_dbLink) {
$this->_dbLink = null;
}
if ($this->_mongo) {
$this->_mongo->close();
}
return true;
}
示例13: serialize
/**
* 析构函数
* 执行session存储器实例,将模拟的session内容写入保存
*/
function __destruct()
{
if (!is_object($this->_storageHandler)) {
return '';
}
if (!empty($this->_sess_data) && !empty($this->_session_id)) {
$sess_data = serialize($this->_sess_data);
$this->_storageHandler->write($this->_session_id, $sess_data);
}
$this->_storageHandler->close();
}
示例14: compress
/**
* Compress data into the archive
*
* @param string $sFile Name of the ZIP file
* @param string $sFolder Name of the folder we are going to compress. Must be located within the "file/cache/" folder.
* @return mixed Returns the full path to the newly created ZIP file.
*/
public function compress($sFile, $sFolder)
{
// Create random ZIP
$sArchive = PHPFOX_DIR_CACHE . md5((is_array($sFile) ? serialize($sFile) : $sFile) . Phpfox::getParam('core.salt') . PHPFOX_TIME) . '.zip';
chdir(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS);
if (is_object($this->_oZip)) {
if ($this->_oZip->open($sArchive, ZipArchive::CREATE)) {
$aFiles = Phpfox::getLib('file')->getAllFiles(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS);
foreach ($aFiles as $sNewFile) {
$sNewFile = str_replace(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS, '', $sNewFile);
$this->_oZip->addFile($sNewFile);
}
$this->_oZip->close();
}
} else {
shell_exec(Phpfox::getParam('core.zip_path') . ' -r ' . escapeshellarg($sArchive) . ' ./');
}
chdir(PHPFOX_DIR);
return $sArchive;
}
示例15: onMessage
/**
* onMessage($clientId, $message) get messages from server (request / response)
* @param int $clientId connect identifier
* @param varchar $message costom message throught socket
* @access public
*/
public function onMessage($clientId, $message)
{
// get client ip
$ip = long2ip($this->_server->clients[$clientId][6]);
// check if message length is 0
if (strlen($message) == 0) {
// send nothing
$this->_server->close($clientId);
return;
}
// the speaker is the only person in the room. Don't let them feel lonely.
if (sizeof($this->_server->clients) == 1) {
$this->_server->send($clientId, "There isn't anyone else in the room, but I'll still listen to you. Some one in the dark :))");
} else {
// send the message to everyone but the person who said it
foreach ($this->_server->clients as $id => $client) {
if ($id != $clientId) {
$this->_server->send($id, "User {$clientId} ({$ip}) said \"{$message}\"");
}
}
}
}