1.php中iconv函數使用方法
http://www.jb51.net/article/14530.htm
URL傳中文亂碼問題
http://www.blogjava.net/freeman1984/archive/2010/06/07/322965.html
2.URL傳中文亂碼問題要注意設定頁面編碼方式的時候不光在PHP代碼中要設定,在PHP代碼外還要設定html的編碼格式,例如:
<?php header("Content-type: text/html; charset=utf8"); ?>//php中的設定編碼樣式
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />//設定html頁面的編碼方式
3.//頁面跳轉問題
例如:<script>
function confirm(){
var content=document.getElementById('reply').value;
var xjl=document.getElementById('conf').name;
if(content.length==0)
alert("回複內容不可為空 !");
else{
window.location.href=encodeURI("addreply.php?content="+content+"&fh="+xjl);
}
}
</script>
在php中使用JS來跳轉
$url = "http://rs.xidian.edu.cn/bbs";
echo "<script language='javascript' type='text/javascript'>";
echo "top.location.href='$url'";
echo "</script>";
window.location.href"、"location.href"是本頁面跳轉
"parent.location.href"是上一層頁面跳轉
"top.location.href"是最外層的頁面跳轉
舉例說明:
如果A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js這樣寫
"window.location.href"、"location.href":D頁面跳轉
"parent.location.href":C頁面跳轉
"top.location.href":A頁面跳轉
如果D頁面中有form的話,
<form>: form提交後D頁面跳轉
<form target="_blank">: form提交後彈出新頁面
<form target="_parent">: form提交後C頁面跳轉
<form target="_top"> : form提交後A頁面跳轉
關於頁面重新整理,D 頁面中這樣寫:
"parent.location.reload();": C頁面重新整理 (當然,也可以使用子視窗的 opener 對象來獲得父視窗的對象:window.opener.document.location.reload(); )
"top.location.reload();": A頁面重新整理