过去,当我想在HTML中显示文本内容(textarea - > mySQL数据库)时,我使用nl2br在HTML中正确显示内容。
现在我想在解密数据库内容之后这样做,但它确实不起作用。
$note = openssl_decrypt($note, "AES-256-CBC", "$encode_key", 0 , "$encode_key");
$outputNote = str_replace("\r\n", "test", "$note");
echo $outputNote;
此解决方案出了什么问题?
答案 0 :(得分:0)
确定。这是完整的代码生成注释
$sql_notes = "SELECT content FROM gn_notes WHERE userid = '$sessionID' ORDER BY tstamp DESC";
$result = mysqli_query($db_link, $sql_notes);
$number=mysqli_num_rows($result);
if($number > 0) {
while ($record = mysqli_fetch_assoc($result)) {
$date = date("d.m.Y", $record['tstamp']);
$time = date("H:i", $record['tstamp']);
$note = $record['content'];
/* LOOKING FOR ENCODE_KEY */
$encode_key = getValue('encode_key', 'gn_user', $sessionID, $db_link);
$note = openssl_decrypt($note, "AES-256-CBC", "$encode_key", 0 , "$encode_key");
echo nl2br($note);
}
}
这是网站的输出: Screenshot ouput