ThinkPHP 连接 sql server 返回日期格式 object TO string

ThinkPHP 自带的sqlsrv类库,查询返回的日期类型是object,要取得string类型的话,要改动Thinkphp\Library\Think\Db\Driver\Sqlsrv.class.php文件,

 $connectInfo  =  array('Database'=>$config['database'],'UID'=>$config['username'],'PWD'=>$config['password'],'CharacterSet' => C('DEFAULT_CHARSET'));

这段改为

 $connectInfo  =  array('Database'=>$config['database'],'UID'=>$config['username'],'PWD'=>$config['password'],'CharacterSet' => C('DEFAULT_CHARSET'), 'ReturnDatesAsStrings'=> true);


你可能感兴趣的:(PHP)