problem description
adding < br/ >
or < hr >
to the code when using mcrypt extension encryption reverses the order of the code
the environmental background of the problems and what methods you have tried
PHP:5.6.27
7.0.12
related codes
/ / Please paste the code text below (do not replace the code with pictures)
$str = "PHP";
//1.
$secretkey = "xyipvkrgtferuler";
//2.CBC16
$iv = "6351519006396660";
$encrypt_str = mcrypt_encrypt(MCRYPT_RIJNDAEL_128,$secretkey,$str,MCRYPT_MODE_CBC,$iv);
$encrypt_str = base64_encode($encrypt_str);
echo $encrypt_str;
echo "<hr>";
//
$encrypt_str = base64_decode($encrypt_str);
$str = mcrypt_decrypt(MCRYPT_RIJNDAEL_128,$secretkey,$encrypt_str,MCRYPT_MODE_CBC,$iv);
echo rtrim($str);
what result do you expect? What is the error message actually seen?
F12
View the results of the source code
whether this problem is caused by this function or my environment, I have also searched it with search engines, saying that the function will have more spaces, but var_dump () does not see it, and removing spaces from the final string rtrim () has no effect.