九亭做网站公司,免费注册qq号网站,做二手回收哪个网站好,网页版传奇下载首先#xff0c;去官网下载最新版的kindeditor#xff0c;然后把里面asp#xff0c;jsp#xff0c;net#xff0c;example的全删除#xff0c;然后改名为editor放进public#xff08;最外层目录的public#xff09;文件夹里面 在目录lib目录建立ORG文件夹#xff08;个… 首先去官网下载最新版的kindeditor然后把里面aspjspnetexample的全删除然后改名为editor放进public最外层目录的public文件夹里面 在目录lib目录建立ORG文件夹个人习惯用ORG存储公用类建立一个共用类editor.class.php 下面是这个类的具体代码 ?php /*编辑器调用的初始化类 * */ class editor { var $Width; var $Height; var $Value; /* 此方法是编辑器的构造方法 *第一个参数$Height是高度不填默认是500px *第二个参数$Width是宽度不填默认是700px *第三个参数$Value是编辑器默认内容不填默认是“h2欢迎使用编辑器/h2br” * */ function editor($Height500px,$Width700px,$Valueh2欢迎使用编辑器/h2br) { $this-Value $Value; $this-Height $Height; $this-Width $Width; } /*此方法是在线编辑器的调用 * 在需要编辑器的地方调用此函数 */ function createEditor(){ return textarea namecontent1 stylewidth:$this-Width;height:$this-Height;visibility:hidden;$this-Value/textarea; } /*使用在线编辑器必须在htmlhead/head之间调用此方法才能正确调用 * 内容主要都是script */ function usejs(){ $streot link relstylesheet href__PUBLIC__/editor/themes/default/default.css / link relstylesheet href__PUBLIC__/editor/plugins/code/prettify.css / script charsetutf-8 src__PUBLIC__/editor/kindeditor.js/script script charsetutf-8 src__PUBLIC__/editor/lang/zh_CN.js/script script charsetutf-8 src__PUBLIC__/editor/plugins/code/prettify.js/script script KindEditor.ready(function(K) { var editor1 K.create(textarea[namecontent1], { cssPath : __PUBLIC__/editor/plugins/code/prettify.css, uploadJson : __PUBLIC__/editor/php/upload_json.php, fileManagerJson : __PUBLIC__/editor/php/file_manager_json.php, allowFileManager : true, afterCreate : function() { var self this; K.ctrl(document, 13, function() { self.sync(); K(form[nameexample])[0].submit(); }); K.ctrl(self.edit.doc, 13, function() { self.sync(); K(form[nameexample])[0].submit(); }); } }); prettyPrint(); }); /script eot; return $str; } /*取得在线编辑器的值并返回 */ function getEditorContent(){ $htmlData ; if (!empty($_POST[content1])) { if (get_magic_quotes_gpc()) { $htmlData stripslashes($_POST[content1]); } else { $htmlData $_POST[content1]; } return $htmlData; } } } 代码注释都写的比较清楚了然后在action建立个文件是IndexAction.class.php ?php class IndexAction extends Action { public function _initialize() { header(Content-Type:text/html; charsetutf-8); } public function index(){ import(.ORG.editor); //导入类 $editornew editor(); //创建一个对象 $a$editor-createEditor(); //返回编辑器 $b$editor-usejs(); //js代码 $this-assign(usejs,$b); //输出到html $this-assign(editor,$a); $this-display(); } public function php(){ import(.ORG.editor); $editornew editor(); $a$editor-getEditorContent(); //获取编辑器的内容 $this-assign(a,$a); $this-display(); // $this-success(数据添加成功); } } 然后在tpl建立index文件夹在里面建立2个html文件 index.html //使用编辑器 !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetUTF-8 titleInsert title here/title {$usejs} /head body form nameexample methodpost action__URL__/php ?php //textarea namecontent1 stylewidth:700px;height:200px;visibility:hidden;/textarea ? {$editor} br / input typesubmit namebutton value提交内容 / (提交快捷键: Ctrl Enter) /form /body /html php.html //获取编辑器的内容 !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetUTF-8 titleInsert title here/title /head body {$a} /body /html