遇見一個GET參數有關問題!在先等到100分!

來源:互聯網
上載者:User
遇見一個GET參數問題!請求協助,急急在先等到100分!!!
地址:
region.php?Act=Modify&Province=北京&City=海澱
會出現:
Internal ? Server ? Error
The ? server ? encountered ? an ? internal ? error ? or ? misconfiguration ? and ? was ? unable ? to ? complete ? your ? request.

Please ? contact ? the ? server ? administrator, ? [email protected] ? and ? inform ? them ? of ? the ? time ? the ? error ? occurred, ? and ? anything ? you ? might ? have ? done ? that ? may ? have ? caused ? the ? error.

More ? information ? about ? this ? error ? may ? be ? available ? in ? the ? server ? error ? log.


--------------------------------------------

Apache/2.0.52 ? (Win32) ? Server ? at ? lll ? Port ? 80

將:region.php?Act=Modify&Province=北京&City=海澱改成:
region.php?Act=Modify&Province=lsdk&City=lul
訪問就沒有任何問題.
為什麼伺服器不能接受 "中文的參數 ";
請求協助.線上等待:
php5.0+apache ? 2+xp ? 本地測試伺服器.



------解決方案--------------------
用url編碼
------解決方案--------------------
urlencode你的中文傳值
------解決方案--------------------
urlencode
------解決方案--------------------
urlencode
------解決方案--------------------
解決了,接分了
------解決方案--------------------
urlencode,隨便哪一種code都成:),接分
------解決方案--------------------
可以直接傳遞

但不相容firefox
------解決方案--------------------
做連結時: ? 'region.php?Act=Modify&Province= '.urlencode( '北京 '). '&City= '.urlencode( '海澱 ');
接收參數時: ? $Province ? = ? urldecode($_GET[ 'Province ']);
? ? ? ? ? ? ? ? ? ? ? ? $City ? = ? urldecode($_GET[ 'City ']);
------解決方案--------------------
region.php?Act=Modify&Province=北京&City=海澱

你是說直接在瀏覽器地址欄上輸入中文?

首先,你的頁面採用的什麼編碼類別型?如果是GBK,GB2312,不存在這個問題,如果統一都是utf-8,那要轉下編碼.
由於在用戶端瀏覽器輸入的文字,編碼都是作業系統預設的,一般來說中文xp採用的是GBK,所以你在頁面上GET到後,會與你的utf-8編碼不統一,get下來後是亂碼.

解決辦法:
$Province ? = ? iconv( ' ', 'utf-8 ',$_GET[ 'Province ']);
$City ? = ? iconv( ' ', 'utf-8 ',$_GET[ 'City ']);

要保證你的伺服器支援iconv函數,否則請用其他方法轉碼.
代碼迷推薦解決方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.daimami.com/java-web/317.html
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.