Home >Backend Development >PHP Tutorial >The wonderful use of instantiationexception php include to achieve path encryption
1. Transfer program include.inc
Copy code The code is as follows:
include_once 'include/Base.php';
$path = '';
$url = isBase::decrypt( urlDecode($_SERVER['QUERY_STRING']));
parse_str($url); //Get the variable passed through url address GET
if(!empty($_POST['path'])){ //Get POST The passed variable
$path = $_POST['path'];
$path = isBase::decrypt(urlDecode($path));
}
//Resolve the real path
if(empty($path)){
//header("Location: login.php");
exit;
}
if(!preg_match("/(^http://)|([?|&|=])/",$path)) {
//Jump to the path of the actual executed file
chdir(dirname($path));
include_once basename($path);
exit;
}
?>
Copy code The code is as follows:
include include.inc;
?>
Copy the code The code is as follows :
"index.php?".encrypt("path=/test/test.php&test=123&test2=4321")
The above has introduced the wonderful use of instantiationexception php include to implement path encryption, including the content of instantiationexception. I hope it will be helpful to friends who are interested in PHP tutorials.