php-fckeditor-ckeditor-案例1

来源:互联网 发布:飞天侠淘宝客9.1破解 编辑:程序博客网 时间:2024/06/05 07:45

 

<?php
/*
 * Created on 2011-2-18
 * 测试编辑器
 * 1,加入ckeditor开源库目录(FCKEditor更名为CKEditor)
 * 2,在测试文件中导入ckeditor.php文件
 * 3,创建对象测试
 */
 //导入CKEditor库中的文件
 include_once("ckeditor/ckeditor.php");
 //创建在线编辑器的对象
 $ck = new CKEditor();//
 //设置编辑器的目录路径
 $ck->basePath="ckeditor/";
//在当前页面得到提交表单内容的值
if($_POST[sub]){//如果提交了表单
 echo $_POST[title]."<br>";
 $edit= $_POST[editor2];
 echo $edit;
}

?>
<html>
<head>
<meta http-equiv="Content-Language" content="en" />
<meta name="GENERATOR" content="PHPEclipse 1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>title</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#FF9966" vlink="#FF9966" alink="#FFCC99">
<!-- 创建表单,在表单中加入编辑器 请求给自己,action为空 -->

  <form action="" method="post" >
  标题内容:
  <input type="text" name="title" value="" /><br>
<?php

// Configuration that will only be used by the second editor.
$config['toolbar'] = array(
    array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
    array( 'Image', 'Link', 'Unlink', 'Anchor' )
);
$config['skin'] = 'v2';//设置皮肤
$initialValue="初始值";
$ck->editor("editor2", $initialValue, $config);
?>
  <input type="submit" name="sub" value="添加新闻"/>

  </form>

</body>
</html>

提示:ckeditor库文件自己从网上下载。

原创粉丝点击