本文整理汇总了PHP中Object::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::connect方法的具体用法?PHP Object::connect怎么用?PHP Object::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::connect方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$options = C("SESSION_OPTIONS");
$this->memcache = new Memcache();
$this->memcache->connect($options['host'], $options['port'], 2.5);
session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
}
示例2: connect
public function connect()
{
$config = C('session.redis');
$this->redis = new Redis();
$this->redis->connect($config['host'], $config['port']);
if (!empty($config['password'])) {
$this->redis->auth($config['password']);
}
$this->redis->select((int) $config['database']);
}
示例3: C
function __construct()
{
$config = C("SESSION_REDIS");
$this->redis = new Redis();
$this->redis->connect($config['host'], $config['port'], 2.5);
if (!empty($config['password'])) {
$this->redis->auth($config['password']);
}
$this->redis->select((int) $config['Db']);
}
示例4: start
/**
* @see \herosphp\session\interfaces\ISession::start().
*/
public static function start($config = NULL)
{
self::$handler = new \Redis();
self::$handler->connect($config['host'], $config['port']);
self::$config = $config;
if (!$config['gc_maxlifetime']) {
self::$config['gc_maxlifetime'] = ini_get('session.gc_maxlifetime');
}
session_set_save_handler(array(__CLASS__, 'open'), array(__CLASS__, 'close'), array(__CLASS__, 'read'), array(__CLASS__, 'write'), array(__CLASS__, 'destroy'), array(__CLASS__, 'gc'));
session_start();
}
示例5: make
public function make()
{
$config = C('session.redis');
$this->redis = new Redis();
$this->redis->connect($config['host'], $config['port']);
if (!empty($config['password'])) {
$this->redis->auth($config['password']);
}
$this->redis->select((int) $config['database']);
session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
}
示例6: C
function __construct()
{
$config = C("SESSION_REDIS");
$this->redis = new Redis();
$this->redis->connect($config['host'], $config['port'], 2.5);
if (!empty($config['password'])) {
$this->redis->auth($config['password']);
}
$this->redis->select((int) $config['db']);
session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
}
示例7: start
/**
* @see \herosphp\session\interfaces\ISession::start().
*/
public static function start($config = NULL)
{
if (!$config) {
if (APP_DEBUG) {
E("config should be pass to app");
}
}
self::$handler = new \Memcache();
self::$handler->connect($config['host'], $config['port']) or E("could not to connect the memcache server!");
self::$config = $config;
if (!$config['gc_maxlifetime']) {
self::$config['gc_maxlifetime'] = ini_get('session.gc_maxlifetime');
}
session_set_save_handler(array(__CLASS__, 'open'), array(__CLASS__, 'close'), array(__CLASS__, 'read'), array(__CLASS__, 'write'), array(__CLASS__, 'destroy'), array(__CLASS__, 'gc'));
session_start();
}
示例8: __construct
public function __construct($samebugKey)
{
/** Set up Samebug Application Key
* @var string $samebugKey
*/
$this->samebugKey = $samebugKey;
/** Set up connector class and create a new instance.
* @var string $connectorClass
*/
$connectorClass = "Samebug\\{$this->connectorType}";
/** Set up the connection.
* @var \Samebug\SamebugRecorderConnectorCurl $connector
*/
$this->connector = new $connectorClass();
$this->connector->setHost($this->connectorHost);
$this->connector->setPlatform(self::SAMEBUG_PLATFORM);
$this->connector->setProtocolVersion(self::SAMEBUG_PROTOCOL_VERSION);
$this->connector->setKey($samebugKey);
$this->connector->connect();
}
示例9: serviceConnect
/**
* Connect the Behavior to a new URL
*
* @param string $url The URL to connect to.
* @param array $options Options Array for the new connection.
* @return bool success
**/
function serviceConnect(&$Model, $url, $options = array())
{
$options = array_merge($this->__settings[$Model->name], $options);
$path = $this->_setPath($url);
$options['host'] = $path['host'];
if ($this->Socket === null) {
$this->Socket = new CakeSocket($options);
} else {
if ($this->Socket->connected && $this->__settings[$Model->name]['persistent'] == false) {
$this->serviceDisconnect($Model);
}
$this->Socket->config = $options;
}
$this->__setInfo(array('connection' => $options, 'host' => $path['host'], 'path' => $path['path']));
return $this->Socket->connect();
}
示例10: connect
/**
* Connect to database
*
* Try to connect to the database provided by LumineConfiguration object.<br />
* If its already connect, use the current connection
* @return void
* @access Public
*/
function connect()
{
LumineLog::logger(1, 'Método <strong>connect</strong> invocado por ' . get_class($this), __FILE__, __LINE__);
if ($this->oTable == null) {
LumineLog::logger(3, 'Entidade não encontrada: ' . get_class($this), __FILE__, __LINE__);
exit;
}
if ($this->conn == null) {
$this->conn =& $this->oTable->config->conn;
}
if ($this->conn->IsConnected() == false) {
LumineLog::logger(1, 'Criando uma nova conexão em ' . get_class($this), __FILE__, __LINE__);
$c = $this->oTable->config->config;
$this->conn->connect($c['host'], $c['user'], $c['password'], $c['database']);
} else {
LumineLog::logger(1, 'Usando conexão cacheada', __FILE__, __LINE__);
}
}
示例11: C
function __construct()
{
$config = C("SESSION_MEMCACHE");
$this->memcache = new Memcache();
$this->memcache->connect($config['host'], $config['port'], 2.5);
}