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;
}