我正在使用具有編碼鏈接選項的Flash播放器。我可以使用下面的代碼成功地對它們進行編碼,但是我找不到解碼的方法,並且它們不提供該選項。PHP:從編碼解碼?
鏈接與球員的工作,我的問題開始的時候,我需要對它們進行編輯。而不是我看到編碼版本的正常鏈接。
<?php
function uppod_enc_replace($str){
$uppod_tmp_a=Array('G','d','R','0','M','Y','4','v','6','u','t','i','f','c','s','l','B','5','n','2','V','Z','J','m','L','=');
$uppod_tmp_b=Array('1','w','Q','o','9','U','a','N','x','D','X','7','z','H','y','3','e','g','T','W','b','8','k','I','p','r');
$uppod_tmp=$str;
$uppod_tmp_from=$uppod_tmp_a;
$uppod_tmp_to=$uppod_tmp_b;
for($i=0;$i<sizeof($uppod_tmp_from);$i++){
$uppod_tmp=uppod_enc_replace_ab($uppod_tmp_from[$i],$uppod_tmp_to[$i],$uppod_tmp);
}
return $uppod_tmp;
}
function uppod_enc_replace_ab($a,$b,$tmp){
$tmp=preg_replace('/'.$a.'/','___',$tmp);
$tmp=preg_replace('/'.$b.'/',$a,$tmp);
$tmp=preg_replace('/___/',$b,$tmp);
return $tmp;
}
function uppod_encode($str,$lkey=''){
$tmp=uppod_enc_replace(base64_encode($str));
if($lkey!=''){
$tmpn=rand(0,strlen($tmp));
$tmp=substr($tmp,0,$tmpn).uppod_enc_replace(base64_encode($lkey)).substr($tmp,$tmpn);
}
return $tmp;
}
?>
什麼我試過到目前爲止:
switching places
$uppod_tmp_from=$uppod_tmp_a;
$uppod_tmp_to=$uppod_tmp_b;
changing base64_encode to base64_decode
測試:
stackoverflow.com
encodes to:
HlQhUWXNwIbs8I6NwsgjVWor
changing base64_encode to base64_decode and switching places with $uppod_tmp_from=$uppod_tmp_a; $uppod_tmp_to=$uppod_tmp_b;
decodes to:
n!RB▒▒▒▒▒▒#Yj+[
只是爲了澄清,這部分是無法解碼?服務器端還是客戶端?服務器端爲 – Leri
。當我編輯鏈接從acp我看到編碼版本。 –