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


PHP getID3::getID3方法代碼示例

本文整理匯總了PHP中getID3::getID3方法的典型用法代碼示例。如果您正苦於以下問題:PHP getID3::getID3方法的具體用法?PHP getID3::getID3怎麽用?PHP getID3::getID3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在getID3的用法示例。


在下文中一共展示了getID3::getID3方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: die

 function getID3_cached_dbm($cache_type, $dbm_filename, $lock_filename)
 {
     // Check for dba extension
     if (!extension_loaded('dba')) {
         die('PHP is not compiled with dba support, required to use DBM style cache.');
     }
     // Check for specific dba driver
     if (function_exists('dba_handlers')) {
         // PHP 4.3.0+
         if (!in_array('db3', dba_handlers())) {
             die('PHP is not compiled --with ' . $cache_type . ' support, required to use DBM style cache.');
         }
     } else {
         // PHP <= 4.2.3
         ob_start();
         // nasty, buy the only way to check...
         phpinfo();
         $contents = ob_get_contents();
         ob_end_clean();
         if (!strstr($contents, $cache_type)) {
             die('PHP is not compiled --with ' . $cache_type . ' support, required to use DBM style cache.');
         }
     }
     // Create lock file if needed
     if (!file_exists($lock_filename)) {
         if (!touch($lock_filename)) {
             die('failed to create lock file: ' . $lock_filename);
         }
     }
     // Open lock file for writing
     if (!is_writeable($lock_filename)) {
         die('lock file: ' . $lock_filename . ' is not writable');
     }
     $this->lock = fopen($lock_filename, 'w');
     // Acquire exclusive write lock to lock file
     flock($this->lock, LOCK_EX);
     // Create dbm-file if needed
     if (!file_exists($dbm_filename)) {
         if (!touch($dbm_filename)) {
             die('failed to create dbm file: ' . $dbm_filename);
         }
     }
     // Try to open dbm file for writing
     $this->dba = @dba_open($dbm_filename, 'w', $cache_type);
     if (!$this->dba) {
         // Failed - create new dbm file
         $this->dba = dba_open($dbm_filename, 'n', $cache_type);
         if (!$this->dba) {
             die('failed to create dbm file: ' . $dbm_filename);
         }
         // Insert getID3 version number
         dba_insert(GETID3_VERSION, GETID3_VERSION, $this->dba);
     }
     // Init misc values
     $this->cache_type = $cache_type;
     $this->dbm_filename = $dbm_filename;
     // Register destructor
     register_shutdown_function(array($this, '__destruct'));
     // Check version number and clear cache if changed
     if (dba_fetch(GETID3_VERSION, $this->dba) != GETID3_VERSION) {
         $this->clear_cache();
     }
     parent::getID3();
 }
開發者ID:Jayriq,項目名稱:mmslides,代碼行數:64,代碼來源:extension.cache.dbm.php

示例2: Exception

 function getID3_cached_mysql($host, $database, $username, $password)
 {
     // Check for mysql support
     if (!function_exists('mysql_pconnect')) {
         throw new Exception('PHP not compiled with mysql support.');
     }
     // Connect to database
     $this->connection = mysql_pconnect($host, $username, $password);
     if (!$this->connection) {
         throw new Exception('mysql_pconnect() failed - check permissions and spelling.');
     }
     // Select database
     if (!mysql_select_db($database, $this->connection)) {
         throw new Exception('Cannot use database ' . $database);
     }
     // Create cache table if not exists
     $this->create_table();
     // Check version number and clear cache if changed
     $version = '';
     if ($this->cursor = mysql_query("SELECT `value` FROM `getid3_cache` WHERE (`filename` = '" . mysql_real_escape_string(GETID3_VERSION) . "') AND (`filesize` = '-1') AND (`filetime` = '-1') AND (`analyzetime` = '-1')", $this->connection)) {
         list($version) = mysql_fetch_array($this->cursor);
     }
     if ($version != GETID3_VERSION) {
         $this->clear_cache();
     }
     parent::getID3();
 }
開發者ID:sahartak,項目名稱:newsroyal,代碼行數:27,代碼來源:extension.cache.mysql.php

示例3: getID3_cached_dbm

 public function getID3_cached_dbm($cache_type, $dbm_filename, $lock_filename)
 {
     // Check for dba extension
     if (!extension_loaded('dba')) {
         throw new Exception('PHP is not compiled with dba support, required to use DBM style cache.');
     }
     // Check for specific dba driver
     if (!function_exists('dba_handlers') || !in_array($cache_type, dba_handlers())) {
         throw new Exception('PHP is not compiled --with ' . $cache_type . ' support, required to use DBM style cache.');
     }
     // Create lock file if needed
     if (!file_exists($lock_filename)) {
         if (!touch($lock_filename)) {
             throw new Exception('failed to create lock file: ' . $lock_filename);
         }
     }
     // Open lock file for writing
     if (!is_writeable($lock_filename)) {
         throw new Exception('lock file: ' . $lock_filename . ' is not writable');
     }
     $this->lock = fopen($lock_filename, 'w');
     // Acquire exclusive write lock to lock file
     flock($this->lock, LOCK_EX);
     // Create dbm-file if needed
     if (!file_exists($dbm_filename)) {
         if (!touch($dbm_filename)) {
             throw new Exception('failed to create dbm file: ' . $dbm_filename);
         }
     }
     // Try to open dbm file for writing
     $this->dba = dba_open($dbm_filename, 'w', $cache_type);
     if (!$this->dba) {
         // Failed - create new dbm file
         $this->dba = dba_open($dbm_filename, 'n', $cache_type);
         if (!$this->dba) {
             throw new Exception('failed to create dbm file: ' . $dbm_filename);
         }
         // Insert getID3 version number
         dba_insert(getID3::VERSION, getID3::VERSION, $this->dba);
     }
     // Init misc values
     $this->cache_type = $cache_type;
     $this->dbm_filename = $dbm_filename;
     // Register destructor
     register_shutdown_function(array($this, '__destruct'));
     // Check version number and clear cache if changed
     if (dba_fetch(getID3::VERSION, $this->dba) != getID3::VERSION) {
         $this->clear_cache();
     }
     parent::getID3();
 }
開發者ID:cyrilix,項目名稱:rompr,代碼行數:51,代碼來源:extension.cache.dbm.php

示例4: WHERE

 function getID3_cached_mysql(&$db)
 {
     // Check version number and clear cache if changed
     $this->database =& $db;
     $this->database->setQuery("SELECT `value` FROM `#__zoom_getid3_cache` WHERE (`filename` = '" . GETID3_VERSION . "') AND (`filesize` = '-1') AND (`filetime` = '-1') AND (`analyzetime` = '-1')");
     $this->cursor = $this->database->query();
     list($version) = @mysql_fetch_array($this->cursor);
     if ($version != GETID3_VERSION) {
         $this->clear_cache();
     }
     parent::getID3();
 }
開發者ID:BGCX261,項目名稱:zoom-gallery-svn-to-git,代碼行數:12,代碼來源:extension.cache.mysql.php

示例5: Exception

 function getID3_cached_mysql($host, $database, $username, $password)
 {
     // Check for mysql support
     if (!function_exists('mysql_pconnect')) {
         throw new Exception('PHP not compiled with mysql support.');
     }
     // Connect to database
     $this->connection = mysql_pconnect($host, $username, $password);
     if (!$this->connection) {
         throw new Exception('mysql_pconnect() failed - check permissions and spelling.');
     }
     // Select database
     if (!mysql_select_db($database, $this->connection)) {
         throw new Exception('Cannot use database ' . $database);
     }
     // Create cache table if not exists
     $this->create_table();
     // Check version number and clear cache if changed
     // $$$ hugh - fix for $this::VERSION, as per main getid3.php fixes.
     // can't use $this::VERSION syntax, even conditionally, since it registers as a parse error before PHP v5.3.0
     // wrapping the new syntax in an eval call should work without causing parse errors in old PHP
     /*
     if ($this->cursor = mysql_query("SELECT `value` FROM `getid3_cache` WHERE (`filename` = '".mysql_real_escape_string($this::VERSION)."') AND (`filesize` = '-1') AND (`filetime` = '-1') AND (`analyzetime` = '-1')", $this->connection)) {
     	list($version) = mysql_fetch_array($this->cursor);
     }
     if ($version != $this::VERSION) {
     	$this->clear_cache();
     }
     */
     $version = '';
     $this_version = '';
     eval('$this_version = $this::VERSION;');
     if ($this->cursor = mysql_query("SELECT `value` FROM `getid3_cache` WHERE (`filename` = '" . mysql_real_escape_string($this_version) . "') AND (`filesize` = '-1') AND (`filetime` = '-1') AND (`analyzetime` = '-1')", $this->connection)) {
         list($version) = mysql_fetch_array($this->cursor);
     }
     if ($version != $this_version) {
         $this->clear_cache();
     }
     parent::getID3();
 }
開發者ID:ppantilla,項目名稱:bbninja,代碼行數:40,代碼來源:extension.cache.mysql.php


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