background image

        

$src

  = 

array

("/","+","=");

        

$dist

 = 

array

("_a","_b","_c");

        

$old

  = 

base64_encode

(

$str

);

        

$new

  = 

str_replace

(

$src

,

$dist

,

$old

);

        

return

 

$new

;

}
 

function

 base_decode(

$str

) {

        

$src

 = 

array

("_a","_b","_c");

        

$dist

  = 

array

("/","+","=");

        

$old

  = 

str_replace

(

$src

,

$dist

,

$str

);

        

$new

 = 

base64_decode

(

$old

);

        

return

 

$new

;

}
 
下面是在浏览器中得到的效果
xOO6w6Osuf65_aiy_atL_b00Ke5_b8jnus6ho6GjoaM_c
urldecode 实例方法很简单
urldecode ( string 

$str

 ) 

解码给出的已编码字符串中的任何

 %##。返回解码后的字符串。

Example #1 urldecode() 例子
代码如下

:

 
<?php

$a

 = 

explode

('&', 

$QUERY_STRING

);

$i

 = 0;

while

 (

$i

 < 

count

(

$a

)) {

    

$b

 = split('=', 

$a

[

$i

]);

    echo

 'Value for parameter ', htmlspecialchars(urldecode(

$b

[0])),

         

' is ', htmlspecialchars(urldecode(

$b

[1])), "<br /> ";

    

$i

++;

}
?>