thinkphp 对百度编辑器里的内容进行保存

模板代码

<!DOCTYPE HTML>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <title>ueditor demo</title>
</head>

<body>
    <!-- 加载编辑器的容器 -->
    <script id="container" name="content" type="text/plain">
    
    </script>
    <!-- 配置文件 -->
    <script type="text/javascript" src="http://localhost/myapp/public/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="http://localhost/myapp/public/ueditor.all.js"></script>
    <!-- 实例化编辑器 -->
    

<form action="__URL__/insert" method="post" >
<textarea name="content" id="myEditor"></textarea>        
<script type="text/javascript">
    UE.getEditor('myEditor', {
    theme:"default", //皮肤
    lang:"zh-cn", //语言
    initialFrameWidth:800,  //初始化编辑器宽度,默认800
    initialFrameHeight:320
});
</script>
<input type="submit" value="提交">
</form>
</body>
</html>

控制器代码

public function insert(){
header("Content-Type:text/html; charset=utf-8"); 
     $Dao = M("admin");
     $Dao->create();
 $Dao->id='1';
 $Dao->user=htmlspecialchars($_POST['content']);
 $Dao->add();
 print_r($Dao);
    }

thinkphp整合ueditor(百度编辑器)方法

posted @ 2014-11-13 23:24  fleam  阅读(775)  评论(0编辑  收藏  举报