简体   繁体   中英

Setting Data to TinyMCE Editor

I have my textbox value set to its data using htmlentities like:

<input type="text" value="<?php echo htmlentities('...');?>" />

The same I did for textarea:

<textarea><?php echo htmlentities('...');?></textarea>

It works fine until I convert the textarea to TinyMCE editor...

When I convert the textarea to TinyMCE editor all the things get crappy and shows the encoded html codes in text editor.

So what can be done to set encoded html data in TinyMCE?

您不应在编辑器内使用htmlentities()

Example from TinyMCE docs :

$sContent = strip_tags(stripslashes($_POST['elm1']),$allowedTags);
...
<textarea id="elm1" name="elm1" rows="15" cols="80"><?php echo $sContent;?></textarea>

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