欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          PHP采用get獲取url漢字出現(xiàn)亂碼怎么辦

          PHP采用get獲取url漢字出現(xiàn)亂碼的解決辦法:使用函數(shù)【string urlencode (string $str)】,將字符串編碼并將其用于URL的請求部分,代碼為【echo '<a href="mycgi?foo=', url】。

          PHP采用get獲取url漢字出現(xiàn)亂碼怎么辦

          PHP采用get獲取url漢字出現(xiàn)亂碼的解決辦法:

          1、使用:

          代碼如下:

          <a href="list.php?plate=<?php echo urlencode("轄區(qū)動態(tài)");?>" charset="utf-8" target="main">[查看]</a>

          然后在list.php頁面這樣用

          代碼如下:

          <?php header("Content-type: text/html; charset=utf-8"); if($_GET['plate']) echo $plate=urldecode($_GET['plate']); ?>

          也就不會亂碼和傳遞不正常了。

          注意此處的接收GET頁面編碼需要和發(fā)送端一致!

          2、關(guān)于string urlencode ( string $str )函數(shù)

          此函數(shù)便于將字符串編碼并將其用于 URL 的請求部分,同時(shí)它還便于將變量傳遞給下一頁。

          示例1 urlencode()

          代碼如下:

          <?php echo '<a href="mycgi?foo=', urlencode($userinput), '">'; ?>

          示例2 urlencode() htmlentities()

          代碼如下:

          <?php $query_string = 'foo=' . urlencode($foo) . '&bar=' . urlencode($bar); echo '<a href="mycgi?' . htmlentities($query_string) . '">'; ?>

          相關(guān)學(xué)習(xí)推薦:php編程(視頻)

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號