zoukankan      html  css  js  c++  java
  • (使用步骤)ThinkPHP3.1.2中如何配置Ckeditor_4.1.1和Ckfindtor(转)

    ThinkPHP3.1.2中如何配置Ckeditor_4.1.1和Ckfindtor  
    一、下载Ckeditor和Ckfinder 
    Ckeditor官网 http://ckeditor.com/download 
    解压ckeditor,放入test2(项目)/Public/ckeditor. (删除里边的smaple文件夹) 
    Ckfinder官网 http://cksource.com/ckfinder/download 解压Ckfinder,放入test2(项目)/Public/ckfinder. (删除里边的_smaple和help文件夹)  
    基本目录结构  
     
     
    二、在TPL/Index/index.html模板中引入ckeditor 

    <!DOCTYPE html> 

    <html> <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>ThinkPHP3.1.2中如何配置Ckeditor_4.1.1和Ckfindtor</title> 

    <script type="text/javascript" src="__PUBLIC__/ckeditor/ckeditor.js"></script> </head> <body>  

    <form action="__URL__/add" method="post"> <textarea name="content"></textarea> <input type="submit" value="提交" /> </form> 
    <script type="text/javascript"> CKEDITOR.replace( 'content',{ 
    filebrowserBrowseUrl : '__PUBLIC__/ckfinder/ckfinder.html', filebrowserImageBrowseUrl : 
    '__PUBLIC__/ckfinder/ckfinder.html?type=Images', filebrowserFlashBrowseUrl : 
    '__PUBLIC__/ckfinder/ckfinder.html?type=Flash', filebrowserUploadUrl : 
    '__PUBLIC__/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files', 
    filebrowserImageUploadUrl : 
    '__PUBLIC__/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images', 
    filebrowserFlashUploadUrl : 
    '__PUBLIC__/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash', }); 
    </script> </body> </html>  
    三、配置ckeditor 
    打开ckeditor/config.js进行配置 
    config.language = 'zh-cn'; //配置语言 

    config.uiColor = '#AADC6E'; //界面颜色 config.width = 700; //宽度  config.height = 350; //高度 

    这里是最基本的配置,其它配置可以从网上搜一下  


    四、配置ckfinder,进行图片、falsh等上传功能 

    1.在项目根目录下新建uploads文件夹

    2.打开ckfinder/config.php文件 
    把第33行中return false 改为 return true 
    把第63行中$baseUrl 改为 $baseUrl = '/test2(项目)/uploads/';  

     

    五、控制器IndexAction.class.php中的代码 
    <?php 
    // 本类由系统自动生成,仅供测试用途 class IndexAction extends Action {     public function index(){ $this->display();     } 
        public function add(){      dump($_POST);     } } 
    运行效果: 
     
    注意: 
    上传中文文件时,会出现乱码,解决方法: 修改上传的文件名,打开
    cdfinder/core/connector/php/php5/CommandHandler/FileUpload.php找到  

    if ($sFileName != $sUnsafeFileName) { 
          $iErrorNumber = CKFINDER_CONNECTOR_ERROR_UPLOADED_INVALID_NAME_RENAMED; } 
    在后面加上下面这两句就可以解决中文乱码问题 
     $sExtension = CKFinder_Connector_Utils_FileSystem::getExtension($sFileName);  $sFileName = date("Ymd")."_".date("His").".".$sExtension;(这两句话是放在花括号后)

     

  • 相关阅读:
    python 之 re模块、hashlib模块
    python 之 random 模块、 shutil 模块、shelve模块、 xml模块
    python 之 time模块、datetime模块(打印进度条)
    python 之 包的使用
    python 之 序列化与反序列化、os模块
    SAP GUI 750 安装包 及 补丁3 共享
    实例:关于ALV控件可编辑的整理
    SAP 文本框实例
    SAP 日志管理
    TO_DATS() AS ABAP_DATE
  • 原文地址:https://www.cnblogs.com/wuyinghong/p/3237378.html
Copyright © 2011-2022 走看看