kindeditor在php中的使用,PHP中使用kindeditor
KindEditor是一套开源的HTML可视化编辑器,主要用于让用户在网站上获得所见即所得编辑效果,兼容IE、Firefox、Chrome、
Safari、Opera等主流浏览器。KindEditor使用JavaScript编写,可以无缝的于Java、.NET、PHP、ASP等程序接 合。
KindEditor非常适合在CMS、商城、论坛、博客、Wiki、电子邮件等互联网应用上使用,2006年7月首次发布2.0以
来,KindEditor依靠出色的用户体验和领先的技术不断扩大编辑器市场占有率,目前在国内已经成为最受欢迎的编辑器之一。
听说是国产的支持一下,还挺好用的就是。
1
2
3
4
Use KindEditor For PHP5
6
7
8
9
10
11 KindEditor.ready(function(K) {12 var editor1 = K.create(‘textarea[name="content1"]‘,{13 cssPath : ‘../plugins/code/prettify.css‘,
14 uploadJson : ‘../php/upload_json.php‘,
15 fileManagerJson : ‘../php/file_manager_json.php‘,
16 allowFileManager : true,
17 afterCreate : function() {18 var self =this;19 K.ctrl(document, 13, function() {20 self.sync();21 K(‘form[name=example]‘)[0].submit();22 });23 K.ctrl(self.edit.doc, 13, function() {24 self.sync();25 K(‘form[name=example]‘)[0].submit();26 });27 }28 });29 prettyPrint();30 });31 KindEditor.ready(function(K) {32 var editor = K.editor({33 allowFileManager : true
34 });35 K(‘#image1‘).click(function() {36 editor.loadPlugin(‘image‘, function() {37 editor.plugin.imageDialog({38 imageUrl : K(‘#url1‘).val(),
39 clickFn : function(url, title, width, height, border,align) {40 K(‘#url1‘).val(url);41 editor.hideDialog();42 }43 });44 });45 });46 });47
48
49
50
51
标题:
52
类别: 鲜奶 酸奶
53
封面图片:(网络图片 + 本地上传)
54
封面描述:
55
内容:
56 s
57
58 (提交快捷键: Ctrl +Enter)59
60
61 Use KindEditor For PHP
1 <?php2 header("Content-type: text/html; charset=utf-8");3 $htmlData = ‘‘;4 if (!empty($_POST[‘content1‘])) {5 if (get_magic_quotes_gpc()) {6 $htmlData = stripslashes($_POST[‘content1‘]);7 } else{8 $htmlData = $_POST[‘content1‘];9 }10 if(!empty($_POST[‘url1‘]))11 echo "My_URL:".$_POST[‘url1‘]."";12 if(!empty($_POST[‘kinds‘]))13 echo "My_Value:".$_POST[‘kinds‘]."";14 echo "My_Content:".$htmlData;15 }16 ?>savegoods.php
另外收得一个加解密类
1 <?php2 function keyED($txt,$encrypt_key)3 {4 $encrypt_key = md5($encrypt_key);5 $ctr=0;6 $tmp = "";7 for ($i=0;$i
16 //加密码函数
17 function encrypt($txt,$key)18 {19 //srand((double)microtime()*1000000);
20 $encrypt_key = md5(rand(0,320000000));21 $ctr=0;22 $tmp = "";23 for ($i=0;$i
27 (substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));28 $ctr++;29 }30 return keyED($tmp,$key);31 }32
33 //解密函数
34 function decrypt($txt,$key)35 {36 $txt = keyED($txt,$key);37 $tmp = "";38 for ($i=0;$i
49 // 开始加密 encrypt $string, and store it in $enc_text
50 $enc_text = encrypt($string,$key);51
52 //开始解密 decrypt the encrypted text $enc_text, and store it in $dec_text
53 $dec_text = decrypt($enc_text,$key);54 print "原始字符串 : $string
\n";55 print "加密后字串 : $enc_text
\n";56 print "解密后字串 : $dec_text
\n";57 ?>ED code
savegoods.php 显示~
原文:http://www.cnblogs.com/MicroHao/p/3617068.html