This commit is contained in:
thinkphp
2016-02-02 14:31:01 +08:00
4 changed files with 21 additions and 21 deletions

View File

@@ -327,6 +327,11 @@ class Route
// 检测URL路由
public static function check($url, $depr = '/', $checkDomain = false)
{
// 检测域名部署
if ($checkDomain) {
self::checkDomain();
}
// 分隔符替换 确保路由定义使用统一的分隔符
if ('/' != $depr) {
$url = str_replace($depr, '/', $url);
@@ -350,11 +355,6 @@ class Route
$rules = array_merge(self::$rules['*'], $rules);
}
// 检测域名部署
if ($checkDomain) {
self::checkDomain();
}
// 检测URL绑定
$return = self::checkUrlBind($url, $rules);
if ($return) {

View File

@@ -51,8 +51,8 @@ class Memcache
foreach ((array) $hosts as $i => $host) {
$port = isset($ports[$i]) ? $ports[$i] : $ports[0];
$this->options['timeout'] > 0 ?
$this->handler->addServer($host, $port, $this->options['persistent'], 1) :
$this->handler->addServer($host, $port, $this->options['persistent'], 1, $this->options['timeout']);
$this->handler->addServer($host, $port, $this->options['persistent'], 1, $this->options['timeout']) :
$this->handler->addServer($host, $port, $this->options['persistent'], 1);
}
}

View File

@@ -18,13 +18,13 @@ class Redis extends SessionHandler
{
protected $handler = null;
protected $config = [
'host' => '127.0.0.1', // 主机
'port' => 6379, // 端口
'password' => '', // 密码
'expire' => 3600, // 有效期
'timeout' => 0, // 超时时间
'persistent' => true, // 是否长连接
'session_name' => '', // memcache key前缀
'host' => '127.0.0.1', // redis主机
'port' => 6379, // redis端口
'password' => '', // 密码
'expire' => 3600, // 有效期(秒)
'timeout' => 0, // 超时时间(秒)
'persistent' => true, // 是否长连接
'session_name' => '', // sessionkey前缀
];
public function __construct($config = [])
@@ -86,11 +86,11 @@ class Redis extends SessionHandler
*/
public function write($sessID, $sessData)
{
if($this->handler->set($this->config['session_name'] . $sessID, $sessData)){
$this->handler->expire($this->config['session_name'] . $sessID, $this->config['expire']);
return true;
if ($this->config['expire'] > 0) {
return $this->handler->setex($this->config['session_name'] . $sessID, $this->config['expire'], $sessData);
} else {
return $this->handler->set($this->config['session_name'] . $sessID, $sessData);
}
return false;
}
/**

View File

@@ -95,7 +95,7 @@ class TagLib
// 别名设置
foreach (explode(',', $val['alias']) as $v) {
$_key = $lib ? $lib . ':' . $v : $v;
$tags[$close][$_key] = $name;
$tags[$close][$_key] = $v;
}
}
}
@@ -136,7 +136,7 @@ class TagLib
// 标签替换 从后向前
foreach ($nodes as $pos => $node) {
// 对应的标签名
$name = $node['name'];
$name = $tags[1][$node['name']];
// 解析标签属性
$attrs = $this->parseAttr($node['begin'][0], $name);
$method = '_' . $name;
@@ -173,7 +173,7 @@ class TagLib
$regex = $this->getRegex(array_keys($tags[0]), 0);
$content = preg_replace_callback($regex, function ($matches) use (&$tags) {
// 对应的标签名
$name = $matches[1];
$name = $tags[0][$matches[1]];
// 解析标签属性
$attrs = $this->parseAttr($matches[0], $name);
$method = '_' . $name;