欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php自定義urlencode,urldecode函數(shù)實(shí)例

 更新時(shí)間:2015年03月24日 12:23:15   作者:ishare  
這篇文章主要介紹了php自定義urlencode,urldecode函數(shù),實(shí)例分析了php字符串轉(zhuǎn)碼的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了php自定義urlencode,urldecode函數(shù)。分享給大家供大家參考。具體如下:

//配合JavaScript的ajaxObject函數(shù), 對(duì)字串進(jìn)行轉(zhuǎn)碼.
function ajax_encode($str){
  $patern = array("/%/","/=/","/&/");
  // % 必須是第一個(gè)項(xiàng), 替換是按項(xiàng)的順序進(jìn)行的.
  $rp = array("%25","%26","%3D");
  return preg_replace($patern,$rp,$str);
}
//逆函數(shù)
function ajax_decode($str){
  $patern = array("/%25/","/%26/","/%3D/");
  $rp = array("%","=","&");
  return preg_replace($patern,$rp,$str);
}

希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論