使用php怎么對URL進行加密解密操作-創(chuàng)新互聯(lián)

使用php怎么對URL進行加密解密操作?相信很多沒有經(jīng)驗的人對此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個問題。

10年積累的成都網(wǎng)站設(shè)計、成都做網(wǎng)站經(jīng)驗,可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認識你,你也不認識我。但先網(wǎng)站制作后付款的網(wǎng)站建設(shè)流程,更有延川免費網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

具體如下:

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="content-language" content="zh-CN" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="widow-target" content="_top" />
<meta name="robots" content="index, follow" />
<meta name="author" content="3945, [email]ljm77@km169.net[/email]" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="copyright" content="Copyright 3945 All Rights Reserved" />
<title>無標題文檔</title>
<style type="text/css">
<!--
a, a:link{text-decoration: none; color:#000000; font-size:9pt;}   a:visited{text-decoration: none; color:#000000;}   a:hover{text-decoration: underline; color:red;}
body, td, p, li, div, select{font-size:9pt; font-family:"宋體";}
-->
</style>
</head>
<body>
<?php
function query_encode($sQuery)
{//加密鏈接
  if(strlen($sQuery)==0)
   {
     return '';
   }
   else
   {
    $s_tem = preg_replace("/&/i", '&', $sQuery);
    $s_tem = preg_replace("/&/i", '&', $s_tem);
    $a_tem = explode('&', $s_tem);
    shuffle($a_tem);
    $s_tem = implode('&', $a_tem);
    $s_tem = rawurlencode($s_tem);
    $s_tem = base64_encode($s_tem);
    $s_tem = strrev($s_tem);
     return $s_tem;
   }
}
function query_decode($sEncode)
{//解密鏈接
  if(strlen($sEncode)==0)
   {
     return '';
   }
   else
   {
    $s_tem = strrev($sEncode);
    $s_tem = base64_decode($s_tem);
    $s_tem = rawurldecode($s_tem);
     return $s_tem;
   }
}
function rebuild_GET()
{//重寫$_GET全局變量
  $_GET = array();
  $s_query = $_SERVER['QUERY_STRING'];
   if(strlen($s_query)==0)
   {
     return;
   }
   else
   {
    $s_tem = query_decode($s_query);
    $a_tem = explode('&', $s_tem);
     foreach($a_tem as $val)
     {
      $tem = explode('=', $val);
      $_GET[$tem[0]] = $tem[1];
     }
   }
}
rebuild_GET();
echo 'GET:<pre>'.print_r($_GET, true).'</pre>';
function testGET()
{
   echo 'Function GET:<pre>'.print_r($_GET, true).'</pre>';
}
testGET();
?>
<br /><br /><br />
<?
for($i=1; $i<10; $i++)
{
  $s_url = query_encode('ac=index:logo& >.$i);
   echo sprintf('<a href="?%s">TEST: %s</a><br />', $s_url, $s_url);
}
?>
</body>
</html>

看完上述內(nèi)容,你們掌握使用php怎么對URL進行加密解密操作的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!

網(wǎng)站欄目:使用php怎么對URL進行加密解密操作-創(chuàng)新互聯(lián)
路徑分享:http://bm7419.com/article22/dgdocc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、定制網(wǎng)站面包屑導(dǎo)航、外貿(mào)建站微信公眾號、App開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)