怎么在php上运用fck编辑器

FCK编辑器是现在用户量用的最多的一款免费php编辑器 适合新手研究
FCK的配置很简单
在表单里运用也很方便
FCK编辑器自己到官方网站下载 百度下就知
下面是教你怎么在php上运用fck编辑器

<?php
header(“content-type:text/html;charset=utf-8”);
$conn=@mysql_connect(“localhost”,”root”,”123″);
mysql_select_db(“test”);
mysql_query(“set names utf8″);
$con=$_POST[‘con’];
if($con!=””){
$sql=”insert into fckedit (content) values(‘$con’)”;
mysql_query($sql);
}
?>
<script>
//验证fck内容是否为空
function check(){
//取fckeditor的内容
var con=FCKeditorAPI.GetInstance(‘con’).GetXHTML(true);
if(con==””){
alert(“不能为空”);
return false;
}else
{
return true;
}
//为fckeditor设置内容
FCKeditorAPI.GetInstance(‘con’).SetHTML(“没问题了”);
return false;
}
</script>
<form action=”fckdb.php” name=”myform” method=”post” onsubmit=”return check()”>

<?php
include(“FCKeditor/fckeditor_php5.php”);
$ed=new FCKeditor(‘con’);
$ed->BasePath=’FCKeditor/’;  //告诉你fck所需要的文件路径
$ed->ToolbarSet=’Default’;
$ed->Value=”这是默认值”;
$ed->Width=’50%’;
$ed->Height=’300px’;
$ed->create();
?>
<input type=”submit” value=”提交”/>
</form>

订阅评论
提醒
guest的头像

0 评论
内联反馈
查看所有评论
0
希望看到您的想法,请您发表评论x