@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\db; |
14 | 14 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | } |
464 | 464 | |
465 | 465 | $fields = array_keys($info); |
466 | - $bind = $type = []; |
|
466 | + $bind = $type = []; |
|
467 | 467 | |
468 | 468 | foreach ($info as $key => $val) { |
469 | 469 | // 记录字段类型 |
@@ -1300,8 +1300,7 @@ discard block |
||
1300 | 1300 | |
1301 | 1301 | // 判断占位符 |
1302 | 1302 | $sql = is_numeric($key) ? |
1303 | - substr_replace($sql, $value, strpos($sql, '?'), 1) : |
|
1304 | - substr_replace($sql, $value, strpos($sql, ':' . $key), strlen(':' . $key)); |
|
1303 | + substr_replace($sql, $value, strpos($sql, '?'), 1) : substr_replace($sql, $value, strpos($sql, ':' . $key), strlen(':' . $key)); |
|
1305 | 1304 | } |
1306 | 1305 | |
1307 | 1306 | return rtrim($sql); |
@@ -1812,9 +1812,11 @@ |
||
1812 | 1812 | |
1813 | 1813 | if ($this->config['rw_separate']) { |
1814 | 1814 | // 主从式采用读写分离 |
1815 | - if ($master) // 主服务器写入 |
|
1815 | + if ($master) { |
|
1816 | + // 主服务器写入 |
|
1816 | 1817 | { |
1817 | 1818 | $r = $m; |
1819 | + } |
|
1818 | 1820 | } elseif (is_numeric($this->config['slave_no'])) { |
1819 | 1821 | // 指定服务器读 |
1820 | 1822 | $r = $this->config['slave_no']; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\db\builder; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\db\connector; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: 麦当苗儿 <[email protected]> <http://zjzit.cn> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\db\exception; |
14 | 14 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | // +---------------------------------------------------------------------- |
7 | 7 | // | Author: zhangyajun <[email protected]> |
8 | 8 | // +---------------------------------------------------------------------- |
9 | -declare (strict_types = 1); |
|
9 | +declare(strict_types=1); |
|
10 | 10 | |
11 | 11 | namespace think; |
12 | 12 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | public function findNamespace(string $namespace) |
516 | 516 | { |
517 | 517 | $allNamespaces = $this->getNamespaces(); |
518 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
518 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
519 | 519 | return preg_quote($matches[1]) . '[^:]*'; |
520 | 520 | }, $namespace); |
521 | 521 | $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | { |
556 | 556 | $allCommands = array_keys($this->commands); |
557 | 557 | |
558 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
558 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
559 | 559 | return preg_quote($matches[1]) . '[^:]*'; |
560 | 560 | }, $name); |
561 | 561 | |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | } |
780 | 780 | } |
781 | 781 | |
782 | - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { |
|
782 | + $alternatives = array_filter($alternatives, function($lev) use ($threshold) { |
|
783 | 783 | return $lev < 2 * $threshold; |
784 | 784 | }); |
785 | 785 | asort($alternatives); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: zhangyajun <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\facade; |
14 | 14 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | //------------------------ |
14 | 14 | // ThinkPHP 助手函数 |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | function parse_name(string $name, int $type = 0, bool $ucfirst = true) |
413 | 413 | { |
414 | 414 | if ($type) { |
415 | - $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) { |
|
415 | + $name = preg_replace_callback('/_([a-zA-Z])/', function($match) { |
|
416 | 416 | return strtoupper($match[1]); |
417 | 417 | }, $name); |
418 | 418 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 |