简体   繁体   English

PHP Base64_decode

[英]PHP Base64_decode

I am using the following code to encode a URL for basic hiding of the URL 我正在使用以下代码对URL进行编码以基本隐藏该URL

/lbs_map.php?msisdn=27827910118

This is what I do not want my clients to see. 这就是我不希望客户看到的东西。 I have coded it the following way 我用以下方式编码

<a href="lbs_map.php?msisdn=<?php echo base64_encode ("27".substr($rows['member_msisdn'],  
1)); ?>

This is my output now: 这是我现在的输出:

/lbs_map.php?msisdn=Mjc4Mjc5MTAxMTk=

I am using this to try and decode the string: 我正在用它来尝试解码字符串:

<?php
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str);
?>

But it is not working at all to decode it and give me the required info i want. 但是对它进行解码并给我我想要的必需信息根本不起作用。 I need help on the decoding of the string 我需要有关字符串解码的帮助

The encode string must work with the code string as the code string varies and is never the same 编码字符串必须与代码字符串一起使用,因为代码字符串会变化并且永远不会相同

如果要通过url传递base64编码的数据,则需要先对其进行urlencode() ,因为=是url中的保留字符。

  1. You need to urlencode() the msisdn parameter. 您需要urlencode() msisdn参数。

  2. Also keep in mind that base64 is not the way to go if you want to hide something from your users as it's not an encryption function and can be easily decoded. 还请记住,如果您想向用户隐藏某些内容, base64并非base64之路,因为它不是加密功能,可以轻松解码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM