zoukankan      html  css  js  c++  java
  • 关于使用ueditor时候遇到的情况

    在使用百度ueditor的时候遇到的一下情况

    1.点击图片之后图片无法在编辑器内显示

    2.从数据库取出图片的时候无法在编辑器内显示

    3.内容存放入数据库取出来之后,HTML效果不显示

    流程:

    1.引入js  我用的是THINKPHP3.2.3 其实影响不大 一个是js路径,一个是表单提交

    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport"
              content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
    <!--引入ueditor-->
    <script src="__PUBLIC__/ueditor/ueditor.config.js"></script>
    <script src="__PUBLIC__/ueditor/ueditor.all.min.js"></script>
    <script src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
    <!--右侧部分开始-->
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row J_mainContent" id="content-main">
            <form action="{:U('editor')}" method="post">
                <textarea name="detail" id="myEditor"></textarea>
                <input type="submit" value="确定">
            </form>
            <div class="clearfix"></div>
        </div>
    </div>
    <script type="text/javascript">
        //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
        //相见文档配置属于你自己的编译器
        var ue = UE.getEditor('myEditor', {
            initialFrameHeight: 300,
            initialFrameWeight: 100
        });
    </script>
    </body>
    </html>


    1.关于图片点击之后无法正常显示的问题,配置config.json

    /ueditor/php/config.json

    找到

    /ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}

    在之前加上你的项目相对于linux服务器html目录的绝对路径

    比如我的项目是在/var/www/html下面的weizhangxiao目录,我想把图片放到

    /var/www/html/weizhangxiao/Public下,所以把以上所有的存储路径改为

    /weizhangxiao/Public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}

    2.输入入库以后发现无法正确读取出图片的路径,我的解决方法是

    在数据入库之前,去除掉所有的反斜杆,替换为’’

    $data['detail'] = str_replace('\','',$data['detail']);//去除反斜杠

    3.当从页面从数据库读取出数据的时候,发现并不能有HTML效果,而且以<p>aaa<a>的形式呈现,我的解决方法是在取出数据之前使用

    html_entity_decode($str)函数

  • 相关阅读:
    Prof. Dr. Ligang Liu (刘利刚) 中国科技大学
    Chi-Wing FU, Philip
    LinuxROS与Android哪个重要?
    深圳市智汇机器人科技有限公司&环宇智行
    【泡泡机器人公开课预告】刘艺博-三维视觉与深度学习
    VS配置FFmpeg开发环境
    VS搭建Boost编程环境
    C++ 多线程编程解决CPU占用率高问题
    C++ 调节PCM音频音量大小
    C++ 采集音频流(PCM裸流)实现录音功能
  • 原文地址:https://www.cnblogs.com/zhouqi666/p/6973255.html
Copyright © 2011-2022 走看看