简体   繁体   English

base64_encode无法正常工作且不会引发错误

[英]base64_encode not working and not throwing errors

base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))) ;

I am using the above line to encrypt a string. 我正在使用以上行来加密字符串。 But some how it is not working. 但是有些不起作用。 The same code works fine on my pc (i am using wamp server). 相同的代码在我的PC上工作正常(我正在使用Wamp Server)。 The problem shows up only when i put it on my linux server which is running php 5.3.27. 仅当我将其放在运行php 5.3.27的linux服务器上时,该问题才会出现。 It does not throw up any errors. 它不会引发任何错误。 The rest of the script after this line is not executed. 此行之后的脚本其余部分不会执行。 I commented out this line and the whole script executed perfectly. 我注释掉了这一行,整个脚本执行得很好。

Maybe remove the space between ) and ; 也许删除);之间的空格;

base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));

Works fine for me like this: 像这样对我很好:

$key = "testkey";
$test = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));

echo $test;

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

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