當前位置: 首頁>>代碼示例>>PHP>>正文


PHP object::close方法代碼示例

本文整理匯總了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;
     }
 }
開發者ID:sugiphp,項目名稱:database,代碼行數:10,代碼來源:SQLiteDriver.php

示例2: __destruct

 /**
  * 析構函數
  */
 public function __destruct()
 {
     if ($this->isConnected) {
         $this->mem->close();
     }
     $this->mem = NULL;
 }
開發者ID:RenzcPHP,項目名稱:3dproduct,代碼行數:10,代碼來源:mem.php

示例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;
 }
開發者ID:javierm,項目名稱:wildflower,代碼行數:37,代碼來源:file.php

示例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;
 }
開發者ID:falconchen,項目名稱:JianshuDaily,代碼行數:13,代碼來源:Zip.php

示例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;
     }
 }
開發者ID:jpbauer,項目名稱:knowledgetree,代碼行數:16,代碼來源:database.php

示例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();
     }
 }
開發者ID:mnapier,項目名稱:opensourcepos,代碼行數:15,代碼來源:Cache_memcached.php

示例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();
     }
 }
開發者ID:tastyigniter,項目名稱:tastyigniter,代碼行數:15,代碼來源:Cache_memcached.php

示例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;
 }
開發者ID:nbari,項目名稱:DALMP,代碼行數:11,代碼來源:Database.php

示例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;
     }
 }
開發者ID:xiaoyueer98,項目名稱:store.heimi.com,代碼行數:14,代碼來源:Db.php

示例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;
	}
開發者ID:niel,項目名稱:lithium,代碼行數:15,代碼來源:MongoDb.php

示例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();
         }
     }
 }
開發者ID:railpage,項目名稱:railpagecore,代碼行數:16,代碼來源:AppCore.php

示例12: __destruct

 /**
  * 析構函數
  *
  * 程序執行完畢,打掃戰場
  *
  * @access public
  *
  * @return void
  */
 public function __destruct()
 {
     if ($this->_dbLink) {
         $this->_dbLink = null;
     }
     if ($this->_mongo) {
         $this->_mongo->close();
     }
     return true;
 }
開發者ID:a53abc,項目名稱:doitphp,代碼行數:19,代碼來源:DbMongo.class.php

示例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();
 }
開發者ID:chibimiku,項目名稱:xweibo_for_discuz_x2_php7,代碼行數:15,代碼來源:session_operator_simulator.class.php

示例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;
 }
開發者ID:Lovinity,項目名稱:EQM,代碼行數:27,代碼來源:zip.class.php

示例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}\"");
             }
         }
     }
 }
開發者ID:stanislav-web,項目名稱:zf2-websocket-server-factory,代碼行數:28,代碼來源:Chat.php


注:本文中的object::close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。