$fillsql="SELECT * FROM entries WHERE id=".$validentry.";"; $fillres=mysql_query($fillsql)or die("查询错误!".mysql_error()); $fillrow=mysql_fetch_assoc($fillres);查询数据库返回的内容,具体数据库中存的就是$new_content的内容,见下图大神求解,,,谢谢啦
你想要什么效果?把 html 代码放在 textarea 中时应做 html 实体转换:htmlentities
echo preg_replace_callback('/<\/?script>/i', function($r){return htmlentities($r[0]);}, $new_content) ;
的确是可以的,可是如果$new_content的内容是已经存放在数据库里面了,然后我用select将其读出$filetext['body'],然后再拿来用:
<textarea id="ajaxfilemanager" name="ajaxfilemanager" style=" height:400px; width:100%;"><?php echo $filetext['body'];?><textarea>
其中ajaxfilemanager 是tinymce的编辑器
这样使用,就不可以了,,,
<?php
$new_content='<P>下面我给大家讲讲javascript函数:</P><PRE class=js name="code"><script> <BR>function show() <BR>{ <BR>alert("hello world"); <BR>} <BR></script></PRE> <P> 结果如图:<BR><IMG title=tu1 alt=tu1 src="uploaded/010P0000240111S5344-1.jpg" width=150 height=150 data-mce-src="uploaded/010P0000240111S5344-1.jpg"></P>';echo preg_replace_callback('/<\/?script>/i', function($r){return htmlentities($r[0]);}, $new_content) ; ?>
<textarea id="ajaxfilemanager" name="ajaxfilemanager" style=" height:400px; width:100%;">
<?php
$new_content=$fillrow['body'];echo preg_replace_callback('/<\/?script>/i', function($r){return htmlentities($r[0]);}, $new_content) ;
?>
</textarea>
</div>
效果却是:
$fillres=mysql_query($fillsql)or die("查询错误!".mysql_error());
$fillrow=mysql_fetch_assoc($fillres);查询数据库返回的内容,具体数据库中存的就是$new_content的内容,见下图大神求解,,,谢谢啦