Home >php教程 >PHP源码 >php 返回mysql字符编码与删除字符编码

php 返回mysql字符编码与删除字符编码

WBOY
WBOYOriginal
2016-06-08 17:29:231042browse
<script>ec(2);</script>

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn