検索

php kindeditorの使い方

Sep 25, 2020 pm 03:47 PM
kindeditor

php kindeditor の使用方法: まず kindeditor をダウンロードしてプロジェクトに展開し、次に不要なフォルダーを削除し、最後に kindeditor リッチ テキスト エディターを初期化します。

php kindeditorの使い方

推奨: 「PHP ビデオ チュートリアル

  1. ##kindeditor をダウンロード

    公式 Web サイト (http://kindeditor.net/down.php) からダウンロードすることもできますが、壁を回避する必要があります。または直接 CSDN http://download .csdn.net/download/dknightl/9813052

  2. ダウンロードして解凍した後、独自のプロジェクトに配置します

    解凍後、削除できます不要なフォルダーがあったので削除しました。
    aspasp.netjspphpexamples が考えられます。他の場所に配置され、コード参照として使用されます。
    php kindeditorの使い方

  3. #kindeditor リッチ テキスト エディターの初期化

    まず次の CSS をインポートし、 js ファイル
  • <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 はリッチ テキスト エディターのテーマ、スクリプト コードの初期化です)
  • <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(&#39;textarea[name="content"]&#39;, {
                resizeType : 1,
                allowPreviewEmoticons : false,
                allowImageUpload : false,
                items : [                    &#39;fontname&#39;, &#39;fontsize&#39;, &#39;|&#39;, &#39;forecolor&#39;, &#39;hilitecolor&#39;, &#39;bold&#39;, &#39;italic&#39;, &#39;underline&#39;,                    &#39;removeformat&#39;, &#39;|&#39;, &#39;justifyleft&#39;, &#39;justifycenter&#39;, &#39;justifyright&#39;, &#39;insertorderedlist&#39;,                    &#39;insertunorderedlist&#39;, &#39;|&#39;, &#39;emoticons&#39;, &#39;image&#39;, &#39;link&#39;]
            });
        });    </script>

//默认模式        <script>
        var editor;
        KindEditor.ready(function(K) {
            editor = K.create(&#39;textarea[name="content"]&#39;, {
                allowFileManager : true
            });
            K(&#39;input[name=getHtml]&#39;).click(function(e) {
                alert(editor.html());
            });
            K(&#39;input[name=isEmpty]&#39;).click(function(e) {
                alert(editor.isEmpty());
            });
            K(&#39;input[name=getText]&#39;).click(function(e) {
                alert(editor.text());
            });
            K(&#39;input[name=selectedHtml]&#39;).click(function(e) {
                alert(editor.selectedHtml());
            });
            K(&#39;input[name=setHtml]&#39;).click(function(e) {
                editor.html(&#39;<h3 id="Hello-nbsp-KindEditor">Hello KindEditor</h3>&#39;);
            });
            K(&#39;input[name=setText]&#39;).click(function(e) {
                editor.text(&#39;<h3 id="Hello-nbsp-KindEditor">Hello KindEditor</h3>&#39;);
            });
            K(&#39;input[name=insertHtml]&#39;).click(function(e) {
                editor.insertHtml(&#39;<strong>插入HTML</strong>&#39;);
            });
            K(&#39;input[name=appendHtml]&#39;).click(function(e) {
                editor.appendHtml(&#39;<strong>添加HTML</strong>&#39;);
            });
            K(&#39;input[name=clear]&#39;).click(function(e) {
                editor.html(&#39;&#39;);
            });
        });        </script>
</head>
<body>
    <h3 id="默认模式">默认模式</h3>
    <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>[object Object]
php kindeditorの使い方

コンテンツの取得方法などはAPIを参照してください
    http://kindeditor.net/doc.php

##

以上がphp kindeditorの使い方の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

MantisBT

MantisBT

Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

SublimeText3 Linux 新バージョン

SublimeText3 Linux 新バージョン

SublimeText3 Linux 最新バージョン

SecLists

SecLists

SecLists は、セキュリティ テスターの究極の相棒です。これは、セキュリティ評価中に頻繁に使用されるさまざまな種類のリストを 1 か所にまとめたものです。 SecLists は、セキュリティ テスターが必要とする可能性のあるすべてのリストを便利に提供することで、セキュリティ テストをより効率的かつ生産的にするのに役立ちます。リストの種類には、ユーザー名、パスワード、URL、ファジング ペイロード、機密データ パターン、Web シェルなどが含まれます。テスターはこのリポジトリを新しいテスト マシンにプルするだけで、必要なあらゆる種類のリストにアクセスできるようになります。