久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

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

      PHP采用get獲取url漢字出現(xiàn)亂碼的解決辦法:使用函數(shù)【string urlencode (string $str)】,將字符串編碼并將其用于URL的請(qǐng)求部分,代碼為【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ū)動(dòng)態(tài)");?>" charset="utf-8" target="main">[查看]</a>

      然后在list.php頁(yè)面這樣用

      代碼如下:

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

      也就不會(huì)亂碼和傳遞不正常了。

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

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

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

      示例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號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)