基于thinkphp的在线编辑器kindeditor

基于thinkphp的在线编辑器kindeditor


2024年5月18日发(作者:ceb文件怎么转换成word)

首先,去官网下载最新版的kindeditor,然后把里面asp,jsp,net,example的全删除,然后

改名为editor放进public(最外层目录的public)文件夹里面。

在目录lib目录建立ORG文件夹(个人习惯用ORG存储公用类),建立一个共用类,

下面是这个类的具体代码

/*编辑器调用的初始化类

*

*/

class editor {

var $Width;

var $Height;

var $Value;

/* 此方法是编辑器的构造方法

*第一个参数,$Height是高度,不填默认是500px

*第二个参数,$Width是宽度,不填默认是700px

*第三个参数,$Value是编辑器默认内容,不填默认是“

欢迎使用编辑器

*

*/

function editor($Height="500px",$Width="700px",$Value="

欢迎使用编辑器

") {

$this->Value = $Value;

$this->Height = $Height;

$this->Width = $Width;

}

/*此方法是在线编辑器的调用

* 在需要编辑器的地方调用此函数

*/

function createEditor(){

return "";

}

/*使用在线编辑器必须在html之间调用此方法,才能正确调用,

* 内容主要都是script

*/

function usejs(){

$str=<<

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;

}

}

}

代码注释都写的比较清楚了,


发布者:admin,转转请注明出处:http://www.yc00.com/xitong/1716009827a2706034.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信