[PHP加密]④--URL编码加密

[PHP加密]④--URL编码加密_第1张图片
Paste_Image.png
[PHP加密]④--URL编码加密_第2张图片
Paste_Image.png
[PHP加密]④--URL编码加密_第3张图片
Paste_Image.png
";
$str = "urlencode.php?username=2+3%4 imooc&king # or \ 1=1  ";
echo urlencode($str);
//urlencode.php%3Fusername%3D2%2B3%254+imooc%26king+%23+or+%5C+1%3D1++
/**
 * ?    %3F
 * =     %3D
 * 空格   +
 * %    %25
 * &    %26
 * \    %5C
 * +    %2B
 */
echo "
"; echo urldecode(urlencode($str)); //urlencode.php?username=2+3%4 imooc&king # or \ 1=1 echo "
"; if (!empty($_GET)) { print_r($_GET); } echo "慕课网信息"; //Array ( [username] => imooc [king] => [age] => 2 ) echo "
"; $username = "imooc&king"; $queryString = "username=" . urlencode($username) . "&age=2"; //地址栏 http://127.0.0.1/test.php?username=imooc%26king&age=2 echo "test"; //Array ( [username] => imooc&king [age] => 2 echo "
"; $url = "https://www.baidu.com/s?wd=%E6%85%95%E8%AF%BE&ie=UTF-8&tn=90816750_hao_pg"; echo urldecode($url);//https://www.baidu.com/s?wd=慕课&ie=UTF-8&tn=90816750_hao_pg echo "
"; echo urlencode("this is a test");//this+is+a+test echo "
"; echo rawurlencode("this is a test");//this%20is%20a%20test echo "
"; echo urldecode("this+is+a+test");//this is a test echo "
"; echo rawurldecode("this%20is%20a%20test");//this is a test ?>
[PHP加密]④--URL编码加密_第4张图片
Paste_Image.png

你可能感兴趣的:([PHP加密]④--URL编码加密)