小弟写了一个函数,其中一个参数是中文的,如下:
//取库存信息
function get_final_store($goods_id,$size,$color)
{   
$sql="SELECT p_store,p_price FROM ". $GLOBALS['ecs']->table('goods_product') ." WHERE p_color='$color' and p_size='$size' and goods_id='$goods_id'";
echo $sql;
    $store  = $GLOBALS['db']->getAll($sql);
    if($store){
$store1=$store['p_store'];
$price=$store['p_price'];
}
print_r($store);
    return $store1;
}调用函数:get_final_store(39,'M',"红色");输出的结果却是:SELECT p_store,p_price FROM `pptshop`.`ribo_goods_product` WHERE p_color='绾㈣壊' and p_size='M' and goods_id='39' Array ( ) 

解决方案 »

  1.   

    统一编码,要是懒得统一编码 那就用red,别用中文了
      

  2.   

    只能是中文了,不能改参数,因为数据库现在能区别出数据的只有这三个数据了!
    我有的是editplus编辑的php文件!
      

  3.   

    你看看这个php文件是什么编码,可以点editplus的 文件(File)->另存为 看encoding是什么,我估计是utf-8
    然后到browser点 查看->编码 看browser又以什么编码解析你的文件 我估计是gb2312
    试试在你的文件最开头加上,header("Content-type:text/html;charset=utf-8");
    或者加meta标签,具体多google