• 关于使用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)函数

  • 相关阅读:
    MyBatis-Generator 最佳实践
    Http请求工具
    多线程编程-之并发编程:阻塞队列
    如数据不存在就插入,存在就更新
    MySQL触发器
    13.multi_match实现dis_max+tie_breaker
    12. tie_breaker的使用原因和使用方法
    11.best fields策略(dis_max参数设置)
    10.多shard场景下relevence score可能不准确
    9.boost权重控制
  • 原文地址:https://www.cnblogs.com/zhouqi666/p/6973255.html
Copyright © 2020-2023  润新知