diff --git a/library/think/Route.php b/library/think/Route.php index 1b6a08c7..f3ca05d6 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -368,7 +368,7 @@ class Route $pattern = $val['pattern']; // 参数有效性检查 - if (!self::checkOption($option)) { + if (!self::checkOption($option, $url)) { continue; } @@ -387,7 +387,7 @@ class Route if (is_array($route)) { $option1 = $route[1]; // 检查参数有效性 - if (!self::checkOption($option1)) { + if (!self::checkOption($option1, $url)) { continue; } $pattern = array_merge($pattern, isset($route[2]) ? $route[2] : []); @@ -453,14 +453,14 @@ class Route } // 路由参数有效性检查 - private static function checkOption($option) + private static function checkOption($option, $url) { // 请求类型检测 if ((isset($option['method']) && false === stripos($option['method'], REQUEST_METHOD)) || (isset($option['ext']) && false === stripos($option['ext'], __EXT__)) // 伪静态后缀检测 || (isset($option['domain']) && !in_array($option['domain'], [$_SERVER['HTTP_HOST'], self::$subDomain])) // 域名检测 || (!empty($option['https']) && !self::isSsl()) // https检测 - || (!empty($option['before_behavior']) && false === Hook::exec($option['before_behavior'])) // 行为检测 + || (!empty($option['before_behavior']) && false === Hook::exec($option['before_behavior'], $url)) // 行为检测 || (!empty($option['callback']) && is_callable($option['callback']) && false === call_user_func($option['callback'])) // 自定义检测 ) { return false; diff --git a/library/think/db/Driver.php b/library/think/db/Driver.php index 2ba26f11..acc1a7c3 100644 --- a/library/think/db/Driver.php +++ b/library/think/db/Driver.php @@ -260,7 +260,7 @@ abstract class Driver // 判断占位符 $sql = is_numeric($key) ? substr_replace($sql, $val, strpos($sql, '?'), 1) : - str_replace(':' . $key, $val, $sql); + str_replace(':' . $key, $this->parseValue($val), $sql); } } return $sql; @@ -506,7 +506,6 @@ abstract class Driver } else { $array[] = $this->parseKey($field); } - } $fieldsStr = implode(',', $array); } elseif (is_string($fields) && !empty($fields)) {