Home > Article > Backend Development > $_session为啥ie中保存汉字乱码,ff,chrome却都正常
$_session为什么ie中保存汉字乱码,ff,chrome却都正常
前几天发了帖子求助,无果,(问题是ie下图片显示不了,ff和chrome下正常)
自己试着echo $_SESSION["goodsid"],
发现
ff下显示session为 袁002@袁003@袁004@ 汉字显示正常,
ie下显示session为?002@?003@?004@, 数字前面的汉字显示成了框框.
肯定是session中汉字存储出了问题,
我的文件都存成了utf-8格式,
session文件为
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> session_start(); header ( "Content-type: text/html; charset=utf-8" ); if($_SESSION["goodsid"]==""){ $_SESSION["goodsid"]=$_GET["id"]."@"; }else{ $array=explode("@",$_SESSION["goodsid"]); if(in_array($_GET["id"],$array)){ $key=array_search($_GET["id"],$array); $array[$key]=""; $_SESSION["goodsid"]=implode("@",$array); }else{ $_SESSION["goodsid"].=$_GET["id"]."@"; } }