在php中使用kind,KindEditor 4.x在PHP中的应用实例!
1.解壓放入php項目靜態資源文件夾,如下圖:
Paste_Image.png
2.如果只是php使用,可以刪除其它類型語言的文件夾,文件結構如下圖:
Paste_Image.png
3.打開php文件夾,更改upload_json.php里文件上傳目錄文件夾至Uploads,修改上傳文件大小限制。如下圖:
Paste_Image.png
4.然后效果圖如下:
Paste_Image.png
firebug審查提交數據,經測試可以正常獲取使用KindEditor4.x獲取圖片實時上傳和textarea內容!
Paste_Image.png
代碼如下:
封面圖:
//圖片數據
內容://文本域內容
//引入jquery文件
KindEditor.ready(function(K) {
//textarea
editor = K.create('#contents', {
//themeType: 'simple',
resizeType : 1,
allowImageRemote : true,
width : '60%',
height : '40%',
uploadJson: '__PUBLIC__/kindeditor/php/upload_json.php',
fileManagerJson: '__PUBLIC__/kindeditor/php/file_manager_json.php',
//items : ['source','bold','italic','underline','forecolor','image'],
afterCreate: function(){this.sync();}, //此行可不寫,不影響獲取textarea的值
afterBlur : function(){this.sync();}//需要添加的
});
//封面圖實時上傳
K('#image').click(function() {
editor.loadPlugin('image', function() {
editor.plugin.imageDialog({
imageUrl : K('#url').val(),
clickFn : function(url, title, width, height, border, align) {
K('#url').val(url);
K("#image_show").html('');
editor.hideDialog();
}
});
});
});
});
總結
以上是生活随笔為你收集整理的在php中使用kind,KindEditor 4.x在PHP中的应用实例!的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 中国联通:陈忠岳已出任中国联通集团董事长
- 下一篇: php中请写出定义变量的两种方法,php