关于中文乱码的问题: SELECT * FROM Nls_Database_Parameters NLS_NCHAR_CHARACTERSET NLS_CHARACTERSET AL32UTF8 NLS_DATE_FORMAT DD-MON-RR NLS_NCHAR_CHARACTERSET UTF8 select Userenv('language') from dual AMERICAN_AMERICA.AL32UTF8 AMERICAN_AMERICA.AL32UTF8 最后方案: 在cmd里加set NLS_LANG=American_America.ZHS16GBK 或在环境里配NLS_LANG <?php error_reporting(0); //$str1="王军"; //$str=iconv('utf-8','gb2312', $str1); //echo $str; require_once('adodb/adodb.inc.php'); $conn = NewADOConnection('oci8'); //$conn->debug = true; $conn->connect('192.168.80.18', ' ', ' ', 'enti '); $conn->charSet ='utf-8'; $conn->SetFetchMode(ADODB_FETCH_ASSOC); //$db->Execute("set names {$config->site_charset}"); //$sql="select Userenv('language') from dual"; //$table=$conn->getAll($sql); //var_dump($table); $sql="select ROLEID, ROLE_NAME, ROLE_DESC, REMARK, DATA_VALID, MODIFY_USERID, MODIFY_DATETIME from entiredba.bs_role"; $table=$conn->getAll($sql); //$str=var_export($table[1],true); //echo $str; $mes = NewADOConnection('mysqli'); $mes->Connect("192.168.80.11", " ", " @!", "wes"); $mes->Execute("set names gbk"); foreach($table as $line){ $sql="delete from entiredba.bs_role where ROLEID='".$line["ROLEID"]."' limit 1"; $rst=$mes->execute($sql); if($rst){ // }else{ echo($mes->ErrorMsg()); } $emp="'".$line["MODIFY_USERID"]."'"; if(strlen($line["MODIFY_USERID"])<2){ $emp="null"; } $ROLE_DESC=$line["ROLE_DESC"]; $ROLE_DESC=str_replace("'"," ",$ROLE_DESC); $REMARK=$line["REMARK"]; $REMARK=str_replace("'"," ",$REMARK); $sql="INSERT INTO entiredba.bs_role(ROLEID, ROLE_NAME, ROLE_DESC, REMARK, DATA_VALID, MODIFY_USERID, MODIFY_DATETIME) VALUES ('".$line["ROLEID"]."', '".$line["ROLE_NAME"]."', '".$ROLE_DESC."','".$REMARK."','".$line["DATA_VALID"]."', {$emp}, now())"; $rst=$mes->execute($sql); if($rst){ echo "."; }else{ echo($mes->ErrorMsg()); } } |
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.