本文整理汇总了PHP中resource::close方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::close方法的具体用法?PHP resource::close怎么用?PHP resource::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resource
的用法示例。
在下文中一共展示了resource::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: disconnect
/**
* Closes the FTP connection
*
* @return boolean
*/
function disconnect()
{
if ($this->archive) {
$this->archive->close();
$this->archive = null;
}
return true;
}
示例2: tickProcessor
private function tickProcessor()
{
while (!$this->server->isShutdown()) {
$start = microtime(true);
$this->tick();
$time = microtime(true);
if ($time - $start < 0.01) {
@time_sleep_until($time + 0.01 - ($time - $start));
}
}
$this->tick();
$this->socket->close();
}
示例3: __destruct
/**
* Destroy this cell collection
*/
public function __destruct()
{
if (!is_null($this->_DBHandle)) {
$this->_DBHandle->close();
}
$this->_DBHandle = null;
}
示例4: __destruct
/**
* Destroy this cell collection
*/
public function __destruct()
{
if (!is_null($this->_DBHandle)) {
$this->_DBHandle->exec('DROP TABLE kvp_' . $this->_TableName);
$this->_DBHandle->close();
}
$this->_DBHandle = null;
}
示例5: __destruct
/**
* Destructor for the Memcache backend.
*/
public function __destruct()
{
self::$connectionCounter[$this->connectionIdentifier]--;
// Save to ignore persistent connections, since close() does not affect them
if (self::$connectionCounter[$this->connectionIdentifier] === 0) {
$this->memcache->close();
}
}
示例6: disconnect
/**
* Disconnects this connection
* @return null
*/
public function disconnect()
{
if (!$this->isConnected()) {
return;
}
$this->connection->close();
$this->connection = null;
}
示例7: quit
/**
* Sends a QUIT command to the irc server and closes the socket
*
* @param string $quitmsg Quit message
*
* @return booolean True on success
*/
public function quit($quitmsg)
{
global $ircNetworks;
$this->raw(sprintf('QUIT :%s', $quitmsg));
logWrite(L_SYSTEM, sprintf('[IRC] Disconnecting from %s (%s:%s)', $this->network, $this->server['server'], $this->server['port']));
$this->socket->close();
if (isset($ircNetworks[$this->network])) {
unset($ircNetworks[$this->network]);
}
return true;
}
示例8: recvData
/**
* 从服务端接收数据
* @throws Exception
*/
public function recvData()
{
if (self::$useSwoole) {
$res = $this->swooleClient->recv();
$this->swooleClient->close();
} else {
$res = fgets($this->connection);
$this->closeConnection();
}
if (!$res) {
throw new Exception("recvData empty");
}
return JsonProtocol::decode($res);
}
示例9: close
/**
* Close
*
* Releases locks and closes connection.
*
* @return bool
*/
public function close()
{
if (isset($this->_redis)) {
try {
if ($this->_redis->ping() === '+PONG') {
isset($this->_lock_key) && $this->_redis->delete($this->_lock_key);
if (!$this->_redis->close()) {
return FALSE;
}
}
} catch (RedisException $e) {
}
$this->_redis = NULL;
return TRUE;
}
return TRUE;
}
示例10: close
/**
* Close
*
* Releases locks and closes connection.
*
* @return bool
*/
public function close()
{
if (isset($this->_redis)) {
try {
if ($this->_redis->ping() === '+PONG') {
$this->_release_lock();
if ($this->_redis->close() === FALSE) {
return $this->_fail();
}
}
} catch (RedisException $e) {
log_message('error', 'Session: Got RedisException on close(): ' . $e->getMessage());
}
$this->_redis = NULL;
return $this->_success;
}
return $this->_success;
}
示例11: setCursor
/**
* sets the statement cursor to key
*
* @param int $k
* @return boolean
*/
public function setCursor($k)
{
if (isset($this->result) && $this->result) {
$this->result->close();
}
if ($k != $this->_i) {
@$this->_statement[$this->_i]->free_result();
}
$this->_bound = array();
if (!is_array($this->_statement)) {
return false;
}
if (!array_key_exists($k, $this->_statement)) {
return false;
}
$this->_i = $k;
return true;
}
示例12: close
/**
* Close
*
* Releases locks and closes connection.
*
* @return bool
*/
public function close()
{
if (isset($this->redis)) {
try {
if ($this->redis->ping() === '+PONG') {
isset($this->lockKey) && $this->redis->delete($this->lockKey);
if (!$this->redis->close()) {
return FALSE;
}
}
} catch (\RedisException $e) {
$this->logger->error('Session: Got RedisException on close(): ' . $e->getMessage());
}
$this->redis = NULL;
return TRUE;
}
return TRUE;
}
示例13: close
/**
* Close
*
* Releases locks and closes connection.
*
* @return bool
*/
public function close()
{
if (isset($this->_redis)) {
try {
if ($this->_redis->ping() === '+PONG') {
isset($this->_lock_key) && $this->_redis->delete($this->_lock_key);
if (!$this->_redis->close()) {
return $this->_failure;
}
}
} catch (RedisException $e) {
log_message('error', 'Session: Got RedisException on close(): ' . $e->getMessage());
}
$this->_redis = NULL;
return $this->_success;
}
return $this->_success;
}
示例14: exec
/**
* Execute the request.
*/
function exec()
{
$this->connect();
switch ($this->method) {
case 'GET':
$this->get();
break;
case 'POST':
$this->post();
break;
case 'PUT':
$this->put();
break;
case 'DELETE':
$this->delete();
break;
}
$this->db->close();
}
示例15: close
/**
* 关闭数据库连接
*
*/
function close()
{
if ($this->conn) {
switch ($this->type) {
case 'SQLite2':
sqlite_close($this->conn);
break;
case 'SQLite3':
$this->conn->close();
break;
case 'PDO':
break;
}
}
$this->conn = null;
$this->lasterr = null;
$this->lasterrcode = null;
$this->_transCount = 0;
$this->_transCommit = true;
}