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

View File

@@ -51,8 +51,8 @@ class Memcache
foreach ((array) $hosts as $i => $host) { foreach ((array) $hosts as $i => $host) {
$port = isset($ports[$i]) ? $ports[$i] : $ports[0]; $port = isset($ports[$i]) ? $ports[$i] : $ports[0];
$this->options['timeout'] > 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 $handler = null;
protected $config = [ protected $config = [
'host' => '127.0.0.1', // 主机 'host' => '127.0.0.1', // redis主机
'port' => 6379, // 端口 'port' => 6379, // redis端口
'password' => '', // 密码 'password' => '', // 密码
'expire' => 3600, // 有效期 'expire' => 3600, // 有效期(秒)
'timeout' => 0, // 超时时间 'timeout' => 0, // 超时时间(秒)
'persistent' => true, // 是否长连接 'persistent' => true, // 是否长连接
'session_name' => '', // memcache key前缀 'session_name' => '', // sessionkey前缀
]; ];
public function __construct($config = []) public function __construct($config = [])
@@ -86,11 +86,11 @@ class Redis extends SessionHandler
*/ */
public function write($sessID, $sessData) public function write($sessID, $sessData)
{ {
if($this->handler->set($this->config['session_name'] . $sessID, $sessData)){ if ($this->config['expire'] > 0) {
$this->handler->expire($this->config['session_name'] . $sessID, $this->config['expire']); return $this->handler->setex($this->config['session_name'] . $sessID, $this->config['expire'], $sessData);
return true; } 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) { foreach (explode(',', $val['alias']) as $v) {
$_key = $lib ? $lib . ':' . $v : $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) { foreach ($nodes as $pos => $node) {
// 对应的标签名 // 对应的标签名
$name = $node['name']; $name = $tags[1][$node['name']];
// 解析标签属性 // 解析标签属性
$attrs = $this->parseAttr($node['begin'][0], $name); $attrs = $this->parseAttr($node['begin'][0], $name);
$method = '_' . $name; $method = '_' . $name;
@@ -173,7 +173,7 @@ class TagLib
$regex = $this->getRegex(array_keys($tags[0]), 0); $regex = $this->getRegex(array_keys($tags[0]), 0);
$content = preg_replace_callback($regex, function ($matches) use (&$tags) { $content = preg_replace_callback($regex, function ($matches) use (&$tags) {
// 对应的标签名 // 对应的标签名
$name = $matches[1]; $name = $tags[0][$matches[1]];
// 解析标签属性 // 解析标签属性
$attrs = $this->parseAttr($matches[0], $name); $attrs = $this->parseAttr($matches[0], $name);
$method = '_' . $name; $method = '_' . $name;