php實(shí)現(xiàn)URL加密解密的方法
本文實(shí)例講述了php實(shí)現(xiàn)URL加密解密的方法。分享給大家供大家參考,具體如下:
<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>無標(biāo)題文檔</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& style="color: #007700">.$i); echo sprintf('<a href="?%s">TEST: %s</a><br />', $s_url, $s_url); } ?> </body> </html>
PS:關(guān)于加密解密感興趣的朋友還可以參考本站在線工具:
URL網(wǎng)址16進(jìn)制加密工具:
http://tools.jb51.net/password/urlencodepwd
密碼安全性在線檢測:
http://tools.jb51.net/password/my_password_safe
高強(qiáng)度密碼生成器:
http://tools.jb51.net/password/CreateStrongPassword
MD5在線加密工具:
http://tools.jb51.net/password/CreateMD5Password
迅雷、快車、旋風(fēng)URL加密/解密工具:
http://tools.jb51.net/password/urlrethunder
在線散列/哈希算法加密工具:
http://tools.jb51.net/password/hash_encrypt
更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《php加密方法總結(jié)》、《PHP編碼與轉(zhuǎn)碼操作技巧匯總》、《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》、《PHP數(shù)學(xué)運(yùn)算技巧總結(jié)》、《PHP數(shù)組(Array)操作技巧大全》、《php字符串(string)用法總結(jié)》、《PHP數(shù)據(jù)結(jié)構(gòu)與算法教程》、《php程序設(shè)計(jì)算法總結(jié)》、《php正則表達(dá)式用法總結(jié)》、及《php常見數(shù)據(jù)庫操作技巧匯總》
希望本文所述對大家PHP程序設(shè)計(jì)有所幫助。
相關(guān)文章
php微信開發(fā)之自定義菜單實(shí)現(xiàn)
這篇文章主要為大家詳細(xì)介紹了php微信開發(fā)之自定義菜單實(shí)現(xiàn)代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-11-11PHP實(shí)現(xiàn)對png圖像進(jìn)行縮放的方法(支持透明背景)
這篇文章主要介紹了PHP實(shí)現(xiàn)對png圖像進(jìn)行縮放的方法(支持透明背景),可實(shí)現(xiàn)php針對png圖像的縮放功能,且支持透明背景,具有一定參考借鑒價值,需要的朋友可以參考下2015-07-07PHP實(shí)現(xiàn)基于3DES算法加密解密字符串示例
這篇文章主要介紹了PHP實(shí)現(xiàn)基于3DES算法加密解密字符串,簡單描述了3DES加密算法的概念、原理并結(jié)合實(shí)例形式分析了3DES加密算法具體定義與使用技巧,需要的朋友可以參考下2018-08-08通過實(shí)例解析PHP數(shù)據(jù)類型轉(zhuǎn)換方法
這篇文章主要介紹了通過實(shí)例解析PHP數(shù)據(jù)類型轉(zhuǎn)換方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2020-07-07PHP圖像處理類庫MagickWand用法實(shí)例分析
這篇文章主要介紹了PHP圖像處理類庫MagickWand用法,較為詳細(xì)的分析了php中圖像處類庫MagickWand的相關(guān)使用技巧,需要的朋友可以參考下2015-05-05php使用scandir()函數(shù)掃描指定目錄下所有文件示例
這篇文章主要介紹了php使用scandir()函數(shù)掃描指定目錄下所有文件,涉及scandir()函數(shù)目錄掃描、文件遍歷及文件類型判斷等相關(guān)操作技巧,需要的朋友可以參考下2019-06-06jquery+php+ajax顯示上傳進(jìn)度的多圖片上傳并生成縮略圖代碼
這篇文章主要介紹了jquery+php+ajax顯示上傳進(jìn)度的多圖片上傳并生成縮略圖代碼,可實(shí)現(xiàn)帶有進(jìn)度條效果的多圖上傳功能與生成縮略圖功能,是web開發(fā)中非常實(shí)用的技巧,需要的朋友可以參考下2014-10-10