php中iconv函數使用方法,URL傳中文亂碼問題,html頁面跳轉問題

來源:互聯網
上載者:User

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頁面重新整理

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.