@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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; |
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; |
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 | 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; |
14 | 14 |