CI3.0中为了提高些许性能将数据库连接时默认Scrollable属性由SQLSRV_CURSOR_STATIC变成了SQLSRV_CURSOR_BUFFERED,
在system/database/drivers/sqlsrv/sqlsrv_driver.php文件中,
public function __construct($params)
{
parent::__construct($params);
// This is only supported as of SQLSRV 3.0
if ($this->scrollable === NULL)
{
$this->scrollable = defined('SQLSRV_CURSOR_CLIENT_BUFFERED')
? SQLSRV_CURSOR_CLIENT_BUFFERED
: FALSE;
}
}
把这个属性改回SQLSRV_CURSOR_STATIC后中文显示正常了 具体原理不明
网友评论