当前位置: 首页>>代码示例>>PHP>>正文


PHP resource::get方法代码示例

本文整理汇总了PHP中resource::get方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::get方法的具体用法?PHP resource::get怎么用?PHP resource::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在resource的用法示例。


在下文中一共展示了resource::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getResponse

 /**
  * Return Http Response object for a given url.
  */
 public function getResponse($url)
 {
     try {
         $response = $this->http_client->get($url, array('headers' => $this->getRequestHeaders()));
         if (empty($response)) {
             throw new MigrateException('No response at ' . $this->getPath() . '.');
         }
     } catch (RequestException $e) {
         throw new MigrateException('Error message: ' . $e->getMessage() . ' at ' . $url . '.');
         $response = NULL;
     }
     return $response;
 }
开发者ID:karens,项目名称:migrate_source_json,代码行数:16,代码来源:JSONClient.php

示例2: get

 /**
  * 获取缓存
  * @param string $key 缓存键
  * @param int $lockTime  缓存锁失效时间
  * @return mixed
  */
 public function get($key, $lockTime = 3)
 {
     $key = DAGGER_MC_KEY_PREFIX . $key;
     if ($this->snowslide) {
         $outdated = $this->mc->get($key . self::CACHE_TIME_CTL);
         $data = $this->mc->get($key);
         if ($data === false || $outdated === false || isset($_GET['_flush_cache']) && $_GET['_flush_cache'] == 1) {
             if ($this->getLock($key, $lockTime)) {
                 defined('DAGGER_DEBUG') && BaseModelCommon::debug(false, "mc_get_not_lock({$key})");
                 return false;
             }
             $attempt = 0;
             do {
                 $dataNew = $this->mc->get($key);
                 if (++$attempt >= 4) {
                     break;
                 }
                 if ($dataNew === false) {
                     usleep(100000);
                 } else {
                     return $dataNew;
                 }
             } while ($data === false);
         }
     } else {
         $data = $this->mc->get($key);
     }
     defined('DAGGER_DEBUG') && BaseModelCommon::debug($data, "mc_get({$key})");
     return $data;
 }
开发者ID:az0ne,项目名称:diaoyu,代码行数:36,代码来源:BaseModelMemcache.php

示例3: get

 /**
  * This function will download a file from the ftp-server.
  *
  * @access  public
  * @param   string $remote_file The absolute or relative path to the file to download
  * @param   string $local_file  The local file to put the downloaded in
  * @param   bool   $overwrite   (optional) Whether to overwrite existing file
  * @param   int    $mode        (optional) Either FTP_ASCII or FTP_BINARY
  * @return  mixed               True on success, otherwise Jaws_Error
  */
 function get($remote_file, $local_file, $overwrite = false, $mode = null)
 {
     $res = $this->_ftp->get($remote_file, $local_file, $overwrite, $mode);
     if (PEAR::isError($res)) {
         return new Jaws_Error($res->getMessage(), __FUNCTION__);
     }
     return true;
 }
开发者ID:uda,项目名称:jaws,代码行数:18,代码来源:FTP.php

示例4: fetch

 /**
  * Returns the data from the cache associated with key $key.
  *
  * @param mixed $key
  * @return mixed
  */
 public function fetch($key)
 {
     if (strlen($key) > self::MAX_KEY_LENGTH) {
         throw new ezcCacheInvalidKeyException($key, 'Length > ' . self::MAX_KEY_LENGTH . '.');
     }
     $data = $this->memcache->get($key);
     return is_object($data) ? $data->var : false;
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:14,代码来源:memcache_backend.php

示例5: _getMemcached

 /**
  * 读取缓存,使用pecl-memcached
  *
  * @param mixed $keys
  * @access protected
  * @return mixed
  */
 protected function _getMemcached($keys)
 {
     if (is_array($keys)) {
         return $this->_conn->getMulti($keys);
     } else {
         return $this->_conn->get($keys);
     }
 }
开发者ID:Debenson,项目名称:openwan,代码行数:15,代码来源:memcached.php

示例6: _write

 /**
  * Writes session data to the memcache based session storage handler
  *
  * @param string $id The ID of the session
  * @param string $value The session data to store
  * @access protected
  */
 protected function _write($id, $value)
 {
     $id = 'sess_' . $id;
     if ($this->_conn->get($id)) {
         return $this->_conn->replace($id, $value, 0, $this->_life_time);
     } else {
         return $this->_conn->set($id, $value, 0, $this->_life_time);
     }
 }
开发者ID:heshuai64,项目名称:gamestore,代码行数:16,代码来源:memcache.php

示例7: get

 /**
  * get
  * @param string $key
  * @param string $tableName
  * @param resource $connectionResource
  * @return boolean
  */
 public function get($key, $tableName, $connectionResource)
 {
     $cachedArray = $connectionResource->get($this->getRealKey($tableName, $key));
     if (is_array($cachedArray) && (0 == $cachedArray["ttl"] || $cachedArray["ttl"] > time())) {
         return $cachedArray["value"];
     } else {
         return false;
     }
 }
开发者ID:zhangshijle,项目名称:Python3,代码行数:16,代码来源:CacheAdapterFile.php

示例8: read

 /**
  * Read
  *
  * Reads session data and acquires a lock
  *
  * @param	string	$session_id	Session ID
  * @return	string	Serialized session data
  */
 public function read($session_id)
 {
     if (isset($this->_redis) && $this->_get_lock($session_id)) {
         // Needed by write() to detect session_regenerate_id() calls
         $this->_session_id = $session_id;
         $session_data = (string) $this->_redis->get($this->_key_prefix . $session_id);
         $this->_fingerprint = md5($session_data);
         return $session_data;
     }
     return $this->_failure;
 }
开发者ID:wms-code,项目名称:CodeIgniter-admin,代码行数:19,代码来源:Session_redis_driver.php

示例9: read

 /**
  * Read
  *
  * Reads session data and acquires a lock
  *
  * @param	string	$session_id	Session ID
  * @return	string	Serialized session data
  */
 public function read($session_id)
 {
     if (isset($this->redis) && $this->lockSession($session_id)) {
         // Needed by write() to detect session_regenerate_id() calls
         $this->_session_id = $session_id;
         $session_data = (string) $this->redis->get($this->keyPrefix . $session_id);
         $this->_fingerprint = md5($session_data);
         return $session_data;
     }
     return FALSE;
 }
开发者ID:titounnes,项目名称:CodeIgniter4,代码行数:19,代码来源:RedisHandler.php

示例10: time

 /**
  * Set expire time on each call since memcache sets it on cache creation.
  *
  * @access private
  *
  * @param string  $key   Cache key to expire.
  * @param integer $lifetime  Lifetime of the data in seconds.
  */
 function _setExpire($key)
 {
     $lifetime = $this->_lifetime;
     $expire = $this->_db->get($key . '_expire');
     // set prune period
     if ($expire + $lifetime < time()) {
         $this->_db->delete($key);
         $this->_db->delete($key . '_expire');
     } else {
         $this->_db->replace($key . '_expire', time());
     }
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:20,代码来源:memcache.php

示例11: _setExpire

 /**
  * Set expire time on each call since memcached sets it on cache creation.
  *
  * @param   string  $key  Cache key to expire.
  *
  * @return  void
  *
  * @since   11.1
  */
 protected function _setExpire($key)
 {
     $lifetime = ini_get("session.gc_maxlifetime");
     $expire = $this->_db->get($key . '_expire');
     // Set prune period
     if ($expire + $lifetime < time()) {
         $this->_db->delete($key);
         $this->_db->delete($key . '_expire');
     } else {
         $this->_db->replace($key . '_expire', time());
     }
 }
开发者ID:nogsus,项目名称:joomla-platform,代码行数:21,代码来源:memcached.php

示例12: get

 /**
  * @param string $remotePath
  * @param string $destFile
  * @param int    $resumePos
  *
  * @return bool
  */
 public function get($remotePath, $destFile, $resumePos = 0)
 {
     switch ($this->_connType) {
         case SftpHelper::TYPE_SFTP:
         default:
             $res = $this->_connection->get($remotePath, $destFile, $resumePos);
             break;
         case SftpHelper::TYPE_FTP:
             $res = @ftp_get($this->_connection, $destFile, $remotePath, FTP_BINARY, $resumePos);
             break;
     }
     return $res;
 }
开发者ID:giovdk21,项目名称:deployii,代码行数:20,代码来源:SftpHelper.php

示例13: exception

 function exception(Exception $e)
 {
     if (ob_get_length() != false) {
         @ob_end_clean();
     }
     $et = typeOf($e);
     if ($et == 'FileNotFoundException' || $et == 'NavigationException') {
         response::setStatus(404);
         header('HTTP/1.1 404 Not Found', true);
         printf("<h1>404: Not Found</h1>");
         return;
     }
     if ($et == 'HttpException') {
         response::setStatus($e->getCode());
         $code = $e->getMessage();
         list($code) = explode(':', $code);
         $code = str_replace('Error ', '', $code);
         $msg = HttpException::getHttpMessage($code);
         header('HTTP/1.1 ' . $code . ' ' . $msg . ' ' . $msg);
         printf("<h1>%s: %s</h1>\n<pre>%s</pre>", $code, $msg, $msg);
         return;
     }
     response::setStatus(500);
     logger::emerg("Unhandled exception: (%s) %s in %s:%d", get_class($e), $e->getMessage(), str_replace(BASE_PATH, '', $e->getFile()), $e->getLine());
     header('HTTP/1.1 501 Server Error', true);
     $id = uniqid();
     $dbg = sprintf("Unhandled exception: (%s) %s\n  in %s:%d", get_class($e), $e->getMessage(), str_replace(SYS_PATH, '', $e->getFile()), $e->getLine()) . Console::backtrace(0, $e->getTrace(), true) . "\n" . "Loaded modules:\n" . ModuleManager::debug() . "\n" . request::getDebugInformation();
     logger::emerg($dbg);
     if (config::get('lepton.mvc.exception.log', false) == true) {
         $logfile = config::get('lepton.mvc.exception.logfile', "/tmp/" . $_SERVER['HTTP_HOST'] . "-debug.log");
         $log = "=== Unhandled Exception ===\n\n" . $dbg . "\n";
         $lf = @fopen($logfile, "a+");
         if ($lf) {
             fputs($lf, $log);
             fclose($lf);
         }
     }
     $ico_error = resource::get('warning.png');
     header('content-type: text/html; charset=utf-8');
     echo '<html><head><title>Unhandled Exception</title>' . self::$css . self::$js . '</head><body>' . '<div id="box"><div id="left"><img src="' . $ico_error . '" width="32" height="32"></div><div id="main">' . '<h1>An Unhandled Exception Occured</h1>' . '<hr noshade>' . '<p>This means that something didn\'t go quite go as planned. This could be ' . 'caused by one of several reasons, so please be patient and try ' . 'again in a little while.</p>';
     if (config::get('lepton.mvc.exception.feedback', false) == true) {
         echo '<p>The administrator of the website has been notified about this error. You ' . 'can help us find and fix the problem by writing a line or two about what you were doing when this ' . 'error occured.</p>';
         echo '<p id="feedbacklink"><a href="javascript:doFeedback();">If you would like to assist us with more information, please click here</a>.</p>';
         echo '<div id="feedback" style="display:none;"><p>Describe in a few short lines what you were doing right before you encountered this error:</p><form action="/errorevent.feedback/' . $id . '" method="post"><div><textarea name="text" style="width:100%; height:50px;"></textarea></div><div style="padding-top:5px; text-align:right;"><input type="button" value=" Close " onclick="closeFeedback();"> <input type="submit" value=" Submit Feedback "></div></form></div>';
     }
     if (config::get('lepton.mvc.exception.showdebug', false) == true) {
         echo '<hr noshade>' . '<a href="javascript:toggleAdvanced();">Details &raquo;</a>' . '<pre id="advanced" style="display:none; height:300px;">' . $dbg . '</pre>';
     }
     echo '<div>' . '</body></html>';
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:50,代码来源:exception.php

示例14: decrement

 /**
  * 指定服务器自减
  * @param string $server_key 服务器标识
  * @param string $key 缓存键
  * @param int $incre 自减值
  * @return int
  */
 public function decrement($key, $incre = 1)
 {
     $this->startRunTime = microtime(true);
     $calls = 1;
     if ($this->native) {
         $ret = $this->mcd->decrement($key, $incre);
     } else {
         $ret = $this->mcd->get($this->_buildKey($key, 'TIME_CTL'));
         if ($this->mcd->getResultCode() === Memcached::RES_SUCCESS) {
             $ret = $this->mcd->decrement($key, $incre);
             $calls++;
         }
         $this->lastResultCode = $this->mcd->getResultCode();
         $this->lastResultMessage = $this->mcd->getResultMessage();
     }
     $this->_checkStats(__FUNCTION__, $calls);
     defined('DAGGER_DEBUG') && BaseModelCommon::debug($ret, "mcd_decrement({$key})");
     return $ret;
 }
开发者ID:az0ne,项目名称:diaoyu,代码行数:26,代码来源:BaseModelMemcached.php

示例15: clean

 /**
  * Clean cache for a group given a mode.
  *
  * group mode		: cleans all cache in the group
  * notgroup mode	: cleans all cache not in the group
  *
  * @access	public
  * @param	string	$group	The cache data group
  * @param	string	$mode	The mode for cleaning cache [group|notgroup]
  * @return	boolean	True on success, false otherwise
  * @since	1.5
  */
 function clean($group, $mode)
 {
     if (!$this->lockindex()) {
         return false;
     }
     $index = $this->_db->get($this->_hash . '-index');
     if ($index === false) {
         $index = array();
     }
     $secret = $this->_hash;
     foreach ($index as $key => $value) {
         if (strpos($value->name, $secret . '-cache-' . $group . '-' . $this->_site) === 0 xor $mode != 'group') {
             $this->_db->delete($value->name, 0);
             unset($index[$key]);
         }
     }
     $this->_db->replace($this->_hash . '-index', $index, 0, 0);
     $this->unlockindex();
     return true;
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:32,代码来源:memcache.php


注:本文中的resource::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。