PHP에서 URL 암호화 및 암호 해독을 구현하는 방법

黄舟
풀어 주다: 2023-03-06 07:54:01
원래의
1675명이 탐색했습니다.

이 기사의 예에서는 PHP에서 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>无标题文档</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, p, select{font-size:9pt; font-family:"宋体";}
-->
</style>
</head>
<body>
<?php
function query_encode($sQuery)
{//加密链接
  if(strlen($sQuery)==0)
   {
     return &#39;&#39;;
   }
   else
   {
    $s_tem = preg_replace("/&/i", &#39;&&#39;, $sQuery);
    $s_tem = preg_replace("/&/i", &#39;&&#39;, $s_tem);
    $a_tem = explode(&#39;&&#39;, $s_tem);
    shuffle($a_tem);
    $s_tem = implode(&#39;&&#39;, $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 &#39;&#39;;
   }
   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[&#39;QUERY_STRING&#39;];
   if(strlen($s_query)==0)
   {
     return;
   }
   else
   {
    $s_tem = query_decode($s_query);
    $a_tem = explode(&#39;&&#39;, $s_tem);
     foreach($a_tem as $val)
     {
      $tem = explode(&#39;=&#39;, $val);
      $_GET[$tem[0]] = $tem[1];
     }
   }
}
rebuild_GET();
echo &#39;GET:<pre class="brush:php;toolbar:false">&#39;.print_r($_GET, true).&#39;
'; function testGET() { echo 'Function GET:
&#39;.print_r($_GET, true).&#39;
'; } testGET(); ?>


.$i); echo sprintf('TEST: %s
', $s_url, $s_url); } ?>
로그인 후 복사


위는 URL 암호화 및 복호화 구현 방법의 내용입니다. PHP 관련 내용을 더 많이 주목해 주세요. PHP 중국어 웹사이트(www.php.cn)!

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!