php 返回mysql字符编码与删除字符编码
function ebak_getsetchar($char){
global $empire;
if(empty($char))
{
return '';
}
$r=$empire->fetch1(show collation like '.$char.';);
return $r['charset'];
}
//---------------------返回设置编码
function ebak_returnsetnames($char){
if(empty($char))
{
return '';
}
$dumpsql=dosetdbchar('.$char.');rn;
return $dumpsql;
}
//--------------------去除字段中的编码
function ebak_replacefieldchar($sql){
global $phome_db_ver;
if($phome_db_ver=='4.0'&&strstr($sql,' character set '))
{
$preg_str=/ character set (.+?) collate (.+?) /is;
$sql=preg_replace($preg_str,' ',$sql);
}
return $sql;
}