php kindeditor使用方法是什么

发布时间:2020-09-22 10:17:27 作者:小新
来源:亿速云 阅读:147

php kindeditor使用方法是什么?这个问题可能是我们日常学习或工作经常见到的。希望通过这个问题能让你收获颇深。下面是小编给大家带来的参考内容,让我们一起来看看吧!

php kindeditor使用方法:首先下载kindeditor并解压到项目中;然后删除不需要的文件夹;最后初始化kindeditor富文本编辑器即可。

php kindeditor使用方法是什么

  1. 下载kindeditor
    可以选择去官网下载(http://kindeditor.net/down.php),不过要翻墙;或者直接CSDNhttp://download.csdn.net/download/dknightl/9813052

  2. 下载解压完放入自己的项目中
    在解压完后可以删除不需要的文件夹,我是删除了aspasp.netjspphpexamples可以放到其他地方,用作代码参考。
    php kindeditor使用方法是什么

  3. 初始化kindeditor富文本编辑器


        <link rel="stylesheet" href="../themes/default/default.css" />
        <script charset="utf-8" src="../kindeditor-min.js"></script>
        <script charset="utf-8" src="../lang/zh_CN.js"></script>
    <textarea id="mul_input" name="content" style="width:700px;height:200px;visibility:hidden;display: block;">KindEditor</textarea> 

    <script>
        //简单模式初始化
        var editor;
        KindEditor.ready(function(K) {
            editor = K.create('textarea[name="content"]', {
                resizeType : 1,
                allowPreviewEmoticons : false,
                allowImageUpload : false,
                items : [                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',                    'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',                    'insertunorderedlist', '|', 'emoticons', 'image', 'link']
            });
        });    </script>

php kindeditor使用方法是什么

        //默认模式        <script>
            var editor;
            KindEditor.ready(function(K) {
                editor = K.create('textarea[name="content"]', {
                    allowFileManager : true
                });
                K('input[name=getHtml]').click(function(e) {
                    alert(editor.html());
                });
                K('input[name=isEmpty]').click(function(e) {
                    alert(editor.isEmpty());
                });
                K('input[name=getText]').click(function(e) {
                    alert(editor.text());
                });
                K('input[name=selectedHtml]').click(function(e) {
                    alert(editor.selectedHtml());
                });
                K('input[name=setHtml]').click(function(e) {
                    editor.html('<h4>Hello KindEditor</h4>');
                });
                K('input[name=setText]').click(function(e) {
                    editor.text('<h4>Hello KindEditor</h4>');
                });
                K('input[name=insertHtml]').click(function(e) {
                    editor.insertHtml('<strong>插入HTML</strong>');
                });
                K('input[name=appendHtml]').click(function(e) {
                    editor.appendHtml('<strong>添加HTML</strong>');
                });
                K('input[name=clear]').click(function(e) {
                    editor.html('');
                });
            });        </script>
    </head>
    <body>
        <h4>默认模式</h4>
        <form style="margin: 0;">
            <textarea name="content" style="width:800px;height:400px;visibility:hidden;display: block;">KindEditor</textarea>
            <p>
                <input type="button" name="getHtml" value="取得HTML" />
                <input type="button" name="isEmpty" value="判断是否为空" />
                <input type="button" name="getText" value="取得文本(包含img,embed)" />
                <input type="button" name="selectedHtml" value="取得选中HTML" />
                <br />
                <br />
                <input type="button" name="setHtml" value="设置HTML" />
                <input type="button" name="setText" value="设置文本" />
                <input type="button" name="insertHtml" value="插入HTML" />
                <input type="button" name="appendHtml" value="添加HTML" />
                <input type="button" name="clear" value="清空内容" />
                <input type="reset" name="reset" value="Reset" />
            </p>
        </form>
    </body>

php kindeditor使用方法是什么


感谢各位的阅读!看完上述内容,你们对php kindeditor使用方法是什么大概了解了吗?希望文章内容对大家有所帮助。如果想了解更多相关文章内容,欢迎关注亿速云行业资讯频道。

推荐阅读:
  1. PHP中is_file、file_exists、is_dir是什么
  2. php中include和require有什么区别?

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

kindeditor php inde

上一篇:php die用法是什么

下一篇:php如何转化为两位小数

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》