简体   繁体   中英

How to correctly save html content in MYSQL table using PHP

How to correctly save HTML content in the MYSQL table using PHP. I used the following functions of PHP but no luck.

$encodedHTML = htmlspecialchars($cs_htmlEditor);
$encodedHTML = urlencode($cs_htmlEditor);

You can try base64_encode and base64_decode , your column data type should be BLOB.

To encode data in base64

$encodedHTML = base64_encode($cs_htmlEditor);

To retrieve the data

$decodedHTML = base64_decode($cs_htmlEditor)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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