這篇文章給大家分享的是有關(guān)Yii使用Ueditor的方法的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考。一起跟隨小編過來看看吧。
創(chuàng)新互聯(lián)建站服務項目包括集美網(wǎng)站建設(shè)、集美網(wǎng)站制作、集美網(wǎng)頁制作以及集美網(wǎng)絡營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,集美網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務的客戶以成都為中心已經(jīng)輻射到集美省份的部分城市,未來相信會繼續(xù)擴大服務區(qū)域并繼續(xù)獲得客戶的支持與信任!
Yii 如何使用 Ueditor ?
首先在入口文件目錄下新建public目錄和uploads目錄;
然后下載Ueditor,解壓到public目錄下;
接著引“ueditor for yii2”庫,并定義自定義上傳目錄;
"imagePathFormat": "/uploads/ueditor/image/{yyyy}{mm}{dd}/{time}{rand:6}", "scrawlPathFormat": "/uploads/ueditor/image/{yyyy}{mm}{dd}/{time}{rand:6}"
最后在視圖中引入使用即可。
<?php use yii\helpers\Html; use yii\bootstrap\ActiveForm; //引入百度編輯器 $this->registerJsFile('@web/public/ueditor/ueditor.config.js');//注冊自定義js $this->registerJsFile('@web/public/ueditor/ueditor.all.min.js'); $this->registerJsFile('@web/public/ueditor/lang/zh-cn/zh-cn.js'); ?> <script> $(function(){ var ue = UE.getEditor('editor'); }) </script> <style> .inline .radio,.inline .checkbox{display: inline-block;margin: 0 5px;} #editor{margin-top: 20px;padding:0;margin:20px 0;width:100%;height:auto;border: none;} </style> <?php $form=ActiveForm::begin([ 'id'=>'upload', 'enableAjaxValidation' => false, 'options'=>['enctype'=>'multipart/form-data'] ]); ?> <?= $form->field($model,'title')->textInput();?> <?= $form->field($model, 'image')->fileInput();?> <?= $form->field($model,'content')->textarea(['rows'=>6,'id'=>'editor','class'=>'col-sm-1 col-md-12']);?> <?= Html::submitButton('提交', ['class'=>'btn btn-primary','name' =>'submit-button']) ?> <?php ActiveForm::end();?>
感謝各位的閱讀!關(guān)于Yii使用Ueditor的方法就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
網(wǎng)頁名稱:Yii使用Ueditor的方法
瀏覽路徑:http://bm7419.com/article46/pssdeg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供、用戶體驗、網(wǎng)站排名、外貿(mào)建站、網(wǎng)站改版、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)