tp5 往mongodb中插入数据时报错,经查是字符编码的关系。
数据源是sqlserver2000,查询出来的格式是GBK,而向mongodb中插入的数据必须是utf8,所以出现了这个错误,转下格式就好了
$encode = mb_detect_encoding($v1[0], array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
$tmp0 = mb_convert_encoding($v1[0], 'UTF-8', $encode);//dd($tmp0);