复制代码 代码如下:
//编码转换函数
function utf8togb($s) {
return iconv('utf-8', 'gbk//IGNORE', $s); // IGNORE 参数是遇到不成转换的字符时忽略
}
//建议把所有中文字段用英文别名替换,方便下面操作还有编码转换等问题
$sql="SELECT [id], [栏目] as typeid, [正题] as title, [作者] as author, convert(text, [正文]) as body FROM [文章表];";
$sql = utf8togb($sql);
新闻热点
疑难解答