久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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)站

      js如何調(diào)用php方法參數(shù)

      js調(diào)用php方法參數(shù)的方法:1、直接URL編碼,代碼為【string = encodeURIComponent( )】;2、使用escape編碼,代碼為【$.getJSON(“admin.php?action=”+escape()】。

      js如何調(diào)用php方法參數(shù)

      本教程操作環(huán)境:windows7系統(tǒng)、javascript1.8.5&&PHP5.6版,DELL G3電腦,該方法適用于所有品牌電腦。

      js調(diào)用php方法參數(shù)的方法:

      第一種,直接URL編碼 比較方便

      JS:

      <script type=”text/javascript”> string = encodeURIComponent(string); location.href = index.php?keyword=’+string; </script>

      php:

      $keyword = (isset($_GET['keyword'])) ? $_GET['keyword'] : ”;

      第二種,使用escape編碼比較復(fù)雜 但兼任性似乎要好,通過(guò)ajax傳遞的時(shí)候可能需要

      JS:

      …….. $.getJSON(“admin.php?action=”+escape(action),function(json){ }) …………

      PHP:

      function unescape($str) { //定義unescape函數(shù) $str = urldecode($str); preg_match_all(“/(?:%u.{4}|&#x.;|&#d+;|.+)/U”,$str,$r); $ar = $r[0]; foreach($ar as $k=>$v) { if(substr($v,0,2) == “%u”) $ar[$k] = iconv(“UCS-2BE”,”utf-8″,pack(“H4″,substr($v,-4))); elseif(substr($v,0,3) == “&#x”) $ar[$k] = iconv(“UCS-2BE”,”utf-8″,pack(“H4″,substr($v,3,-1))); elseif(substr($v,0,2) == “&#”) { $ar[$k] = iconv(“UCS-2BE”,”utf-8″,pack(“n”,substr($v,2,-1))); } } return join(“”,$ar); } $action=unescape($_GET["action"]);

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

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