更新代码,适配php7.4

This commit is contained in:
2026-03-17 17:22:00 +08:00
parent 4c3e17d851
commit b3f52b21d1
4 changed files with 11 additions and 13 deletions
+8 -2
View File
@@ -395,7 +395,7 @@ class Response
if (null == $this->content) {
$content = $this->output($this->data);
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_bool($content) && !is_array($content) && !is_callable([
$content,
'__toString',
])
@@ -403,7 +403,13 @@ class Response
throw new \InvalidArgumentException(sprintf('variable type error %s', gettype($content)));
}
$this->content = (string) $content;
if (is_bool($content)) {
$this->content = $content ? 'true' : 'false';
} elseif (is_array($content)) {
$this->content = json_encode($content);
} else {
$this->content = (string) $content;
}
}
return $this->content;
+2 -3
View File
@@ -1813,11 +1813,10 @@ abstract class Connection
* @access public
* @return integer
*/
public function getExecuteTimes()
public function getExecuteTimes()
{
return Db::$executeTimes;
return json(['times' => Db::$executeTimes]);
}
/**
* 关闭数据库(或者重新连接)
* @access public
+1 -1
View File
@@ -565,7 +565,7 @@ class Query
$seq = (ord(substr($type($value), 0, 1)) % $rule['num']) + 1;
} else {
// 按照字段的首字母的值分表
$seq = (ord($value{0}) % $rule['num']) + 1;
$seq = (ord($value[0]) % $rule['num']) + 1;
}
}
return $this->getTable() . '_' . $seq;