实现很简单,下载后解压到网站目录使用,展示运行文件中包含编辑器
include("fckeditor/fckeditor.php");
我的整个环境路径为:
-fckeditor
|-fckeditor
|-editor.php
之后会出现问题
主要的问题是:
PHP The requested URL /fckeditor/editor/fckeditor.html was not found on this........
这个问题的主要原因是引用的路径名错误
很多人在路径上都会写成:
$sBasePath=dirname($sBasePath).'/‘
其实这是错误的
应该写成:
$sBasePath=dirname($sBasePath).'/fckeditor/';
editor.php 代码如下:
<?php
error_reporting(0);
include("fckeditor/fckeditor.php");
$sBasePath=$_SERVER['PHP_SELF'];
$sBasePath=dirname($sBasePath).'/fckeditor/';
$ed=new FCKeditor('con');
$ed->BasePath=$sBasePath;
if($_POST['sub']){
echo "标题:".$_POST['title']."<br>";
echo "FCK内容:".$_POST['con'];
exit();
}
?>
<form action="" method="post">
标题:<input type="text" name="title" value=""/>
<?php
$ed->Create();
?>
<input type="submit" name="sub" value="添加新闻"/>
</form>