改进db助手函数

This commit is contained in:
thinkphp
2016-07-20 17:37:25 +08:00
parent 64f2ae3df8
commit ac94906c91

View File

@@ -124,7 +124,7 @@ if (!function_exists('input')) {
if ($pos = strpos($key, '.')) {
// 指定参数来源
$method = substr($key, 0, $pos);
if (in_array($method, ['get', 'post', 'put', 'delete', 'param', 'request', 'session', 'cookie', 'server', 'env', 'path', 'file'])) {
if (in_array($method, ['get', 'post', 'put', 'patch', 'delete', 'param', 'request', 'session', 'cookie', 'server', 'env', 'path', 'file'])) {
$key = substr($key, $pos + 1);
} else {
$method = 'param';
@@ -191,7 +191,7 @@ if (!function_exists('db')) {
*/
function db($name = '', $config = [])
{
return Db::connect($config)->name($name);
return Db::connect($config, true)->name($name);
}
}