PHP中如何配置FCKeditor编辑器及上传图片2014-10-18 csdn博客 风火程序员FCKeditor官网:http://ckeditor.com/FCKeditor下载:http://ckeditor.com/download在使用PHP开发留言板、CMS、博客时都涉及文本信息的处理,如何将信息优美地展现在读者面前是PHP网站开发建设者所追求的,而在线编辑器实现了可视化的功能,最早PHP网站开发者都是使用UBB来实现文本信息的展现功能,之后出现了类似于WORD的在线编辑器,今天和大家介绍的是老牌在线编辑器Fckeditor在PHP环境中安装配置与使用方法说明。Fckeditor支持多种开发语言,如PHP、.NET、JAVA等,本文使用的是Fckeditor2.6.6版本,主要介绍Fckeditor2.6.6在PHP环境中如何安装配置以及使用说明。准备工作首先我们需要下载Fckeditor安装源码包,请点击,推荐下载Fckeditor2.6.6,根据系统环境你可以下载zip包或者tar.gz包。Fckeditor安装说明Fckeditor安装非常方便,只要解压下载的Fckeditor2.6.6.zip包,将解压的Fckeditor2.6.6文件夹下fckeditor文件夹复制到相应项目文件夹下即可。如下图Default:

URL:http://www.bianceng.cn/webkf/PHP/201410/45944.htmFckeditor使用方法说明Index.php
<?phprequire_once "editor/fckeditor.php";?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gbk"/><title>编辑器</title></head><body><form action="do.php" method="post" enctype="multipart/form-data"><div class="reviewFace"><img src="images/em01.gif"><input name="cFace" value="images/em01.gif" checked="checked" type="radio"><img src="http://127.0.0.1/editor/images/em02.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em02.gif" type="radio"><img src="http://127.0.0.1/editor/images/em03.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em03.gif" type="radio"><img src="http://127.0.0.1/editor/images/em04.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em04.gif" type="radio"><img src="http://127.0.0.1/editor/images/em05.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em05.gif" type="radio"><img src="http://127.0.0.1/editor/images/em06.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em06.gif" type="radio"><img src="http://127.0.0.1/editor/images/em07.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em07.gif" type="radio"><img src="http://127.0.0.1/editor/images/em08.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em08.gif" type="radio"><img src="http://127.0.0.1/editor/images/em09.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em09.gif" type="radio"><img src="http://127.0.0.1/editor/images/em10.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em10.gif" type="radio"><img src="http://127.0.0.1/editor/images/em14.gif"><input name="cFace" value="http://127.0.0.1/editor/images/em14.gif" type="radio"></div><div class="reviewFace"><?php $FCKeditor = new FCKeditor("cContent"); //name="cContent";$FCKeditor -> Width = "100%";$FCKeditor -> Height = "350";$FCKeditor -> BasePath = "editor/";$FCKeditor -> ToolbarSet = "Default";echo $FCKeditor->CreateHtml();?></div> <input type="submit" value="提交"> </form></body> </html>
说明:默认Fckeditor提供两种模式的工具栏,即Default和Basic,Default提供了所有的Fckeditor工具栏功能,Basic则提供了最基础的Fckeditor工具栏功能,简而言之Default主要是为后台管理人员提供的,而Basic主要为前台用户提供,只要在使用Fckeditor类时配置
<?php$FCKeditor->ToolbarSet = "Basic";?>
如果你对Fckeditor提供的这两种工具栏并不满足,你可以根据需求定义自己的工具栏,可通过第二种方式,即修改fckeditor.js文件来实现,打开fckeditor.js,找到FCKConfig.ToolbarSets,你可以修改和添加Default和Basic模式中定义的工具栏功能,甚至你可以创建一个新的工具栏,比如Leapsoulcn工具栏,在fckeditor.js文件中添加
FCKConfig.ToolbarSets["Leapsoulcn"] = [<span> </span>["Bold","Italic","-","OrderedList","UnorderedList","-","Link","Unlink"]] ;
然后在使用Fckeditor类时,定义