永发信息网

php乱码急求?

答案:6  悬赏:30  手机版
解决时间 2021-06-06 15:45
  • 提问者网友:那叫心脏的地方装的都是你
  • 2021-06-06 11:33

有一个文件“caidan.php”,文件中代码:

====================================================================
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<SCRIPT language=JavaScript>
function move(x, y) {
if (document.all) {
object1.style.pixelLeft += x;
object1.style.pixelTop += y;}
else
if (document.layers) {
document.object1.left += x;
document.object1.top += y;
}};
function position() {
document.object1.left += 0;
document.object1.top += 0;
document.object1.visibility = "show"
};

function makeStatic() {
if (document.all) {object1.style.pixelTop=document.body.scrollTop+20}
else {eval('document.object1.top=eval(window.pageYOffset+20)');}
setTimeout("makeStatic()",0);}
</SCRIPT>
<STYLE type=text/css>.hl {BACKGROUND-COLOR: green; COLOR: white; CURSOR: hand}
.n {}
</STYLE>
<LAYER class=NS onMouseOut="move(-140, 0)"
onmouseover="move(140, 0)" left="0" bgcolor="black" name="object1" top="20"
visibility="hide">
<SCRIPT language=JavaScript>
if (document.all)
document.write('<DIV ID="object1" style="Position : Absolute ;Left : -180px ;Top : 0px ;Width : 0px ;Z-Index : 20">')
</SCRIPT>
<table bgColor=#698CC3 border=0 cellPadding=2 cellSpacing=1 width="190" height="608"
onmouseout="move(-180, 0)" onMouseOver="move(180,0)">
<TBODY>
<TR>
<TD height="20" align="center" valign="middle" bgColor=#009900 background="admin/img/left_bg_top1.png"><FONT face=宋体 size=3><B>导航菜单</B></FONT></TD>
<TD align=middle bgColor=#ffffff rowSpan=50 width=10>
<SCRIPT language=JavaScript>
if (document.all||document.layers)
document.write('<p align="center"><font size="2" face="Arial Black"><img src="img/switchOn.gif"></font></p>')
</SCRIPT>
</TD></TR>
<tr>

<td width="170" valign="top"><span id="menus"></span> <span id="view"></span>
<script>
function tree(n) {
var id = new Array("bar","pad","","");
if(n == 0) { // 初始化变量
n = 1;
i = 0;
s = "";
}
s += "<table>";
for(;i<tree_ar.length-1;i++) {
var k = (n >= tree_ar[i+1][0])?0:1;
s += "<tr id='"+id[k]+"' value="+i+"><td>"+id[k+2]+"</td><td>"+tree_ar[i][1]+"</td></tr>";
if(n > tree_ar[i+1][0]) {
s += "</td></tr></table>";
return tree_ar[i+1][0];
}
if(n < tree_ar[i+1][0]) {
s += "<tr style='display:none' v=1><td></td><td>";
var m = tree(tree_ar[++i][0]);
s += "</td></tr>";
if(m < n) {
s += "</table>";
return m;
}
}
}
s += "</table>";
return s;
}
</script>
<script for="pad" event="onclick">
// 分枝节点的点击响应
v = this.parentElement.rows[this.rowIndex+1].style;
if(v.display == 'block') {
v.display = 'none';
this.cells[0].innerHTML = "";
view.innerHTML = ""; // 自行修改为参数数组定义的闭合动作
}else {
v.display = 'block';
this.cells[0].innerHTML = "";

}

if(! tree_ar[this.value].type)
genTreeInfo(this);
var n = 1*this.value+1;
for(i=n;i<tree_ar.length-1;i++) {
if(tree_ar[i].type == "pad") {
tree_ar[i].obj2.style.display = 'none';
tree_ar[i].obj1.cells[0].innerHTML = "";
}
}
while(tree_ar[--n][0] > 1);
while(--n >= 0)
if(tree_ar[n].type == "pad") {
tree_ar[n].obj2.style.display = 'none';
tree_ar[n].obj1.cells[0].innerHTML = "";
}
function genTreeInfo(o) {
var el = o.parentElement;
for(var i=0;i<el.rows.length;i++) {
if(el.rows[i].id != "") {
tree_ar[el.rows[i].value].type = el.rows[i].id;
}
if(el.rows[i].id == "pad") {
tree_ar[el.rows[i].value].obj1 = el.rows[i];
tree_ar[el.rows[i].value].obj2 = el.rows[i+1];
}
}
}
</script>
<script for="bar" event="onclick">
// 无分枝节点的点击响应
</script>

最佳答案
  • 五星知识达人网友:白昼之月
  • 2021-06-06 12:53

编码问题, utf-8的用记事本编辑是个错误,


用EditPlus吧


下载: http://eoo.name/EditPlus 3.rar


用记事本要在保存时候选择:


全部回答
  • 1楼网友:北城痞子
  • 2021-06-06 18:59

如图,右键,编码,选UTF-8

你的数据库,网页文件编码要统一,就不会出现乱码问题了

  • 2楼网友:鱼忧
  • 2021-06-06 17:24

字符集的问题,你头上定义了字符集为UTF-8的,那么你保存文件的时候,应该把文件也存成UTF-8,还有farme.php这个文件,也需要定义为并保存为UTF-8字符集格式。

  • 3楼网友:几近狂妄
  • 2021-06-06 16:00
一个练口语的经典方法 哈佛独创,不用看,不用记,只需听 只需30天,让你说一口流利英语
  • 4楼网友:一秋
  • 2021-06-06 15:31

鼠标右键,选择UTF-8

  • 5楼网友:第四晚心情
  • 2021-06-06 14:19

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

这个的编码是不是与这个文件的编码一致的。

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯