php項(xiàng)目中百度 UEditor 簡(jiǎn)單安裝調(diào)試和調(diào)用
對(duì)于新手來(lái)說(shuō),只要能實(shí)現(xiàn)功能即可,其它設(shè)置完全默認(rèn)。
預(yù)覽圖:
1.首先 到官網(wǎng)下載,這個(gè)不多說(shuō)。下載后解壓到網(wǎng)站你想要的目錄,我這里放到根目錄下在你需要使用編輯器的地方,插入如下HTML代碼:
<!-- 加載編輯器的容器 --> <!-- 以下腳本中增加文本為初始化內(nèi)容 --> <script id="container" name="sb_remarks" type="text/plain" style="width:600px;height:200px;"> <p> <strong><span style="font-size: 14px;">備注:</span></strong> </p> <p> <br/> </p> </script> <!-- 配置文件 --> <script type="text/javascript" src="./ueditor/ueditor.config.js"></script> <!-- 編輯器源碼文件 --> <script type="text/javascript" src="./ueditor/ueditor.all.js"></script> <!-- 實(shí)例化編輯器 --> <script type="text/javascript"> var ue = UE.getEditor('container'); </script>
2.調(diào)用傳值
只需在php文件中,加入一句
$sb_remarks=$_POST['sb_remarks'];
================================
下面是我的完整事例代碼:
index.html:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlus®"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>設(shè)備檔案</title> </head> <body> <form method="post" action="s.php" name="search" /> <input name="search" type="text" value="" size="15" /> <input type="submit" value="Search" /> </form> <br/> <hr/> 添加設(shè)備 <div> <form action="sb_add.php" method="post"> 設(shè)備名稱:<input type="text" name="sb_name" /><br/> 編碼型號(hào):<input type="text" name="sb_numandtype" /><br/> 生產(chǎn)廠家:<input type="text" name="sb_home" /><br/> 啟用日期:<input type="text" name="sb_usedate" /><br/> 安裝位置:<input type="text" name="sb_address" /><br/> <!--更新日期:<input type="text" name="sb_updatetime" /><br/>--> <!-- <input type="text" name="sb_remarks" /> --> <!-- 加載編輯器的容器 --> <!-- 以下腳本中增加文本為初始化內(nèi)容 --> <script id="container" name="sb_remarks" type="text/plain" style="width:600px;height:200px;"> <p> <strong><span style="font-size: 14px;">備注:</span></strong> </p> <p> <br/> </p> </script> <!-- 配置文件 --> <script type="text/javascript" src="./ueditor/ueditor.config.js"></script> <!-- 編輯器源碼文件 --> <script type="text/javascript" src="./ueditor/ueditor.all.js"></script> <!-- 實(shí)例化編輯器 --> <script type="text/javascript"> var ue = UE.getEditor('container'); </script> <br/> <br/> <input type="submit" value="添加" /> </form> </div> </body> </html>
sb_add.php
<?php $con = mysql_connect("localhost","root","110"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_query("set names 'utf8'",$con); mysql_select_db("bzec", $con); $sb_name=$_POST['sb_name']; $sb_numandtype=$_POST['sb_numandtype']; $sb_home=$_POST['sb_home']; $sb_usedate=$_POST['sb_usedate']; $sb_address=$_POST['sb_address']; //$sb_updatetime=$_POST['sb_updatetime']; $sb_updatetime=date("Y-m-d G:i:s"); $sb_remarks=$_POST['sb_remarks']; //$nikename= trim($nikename); /* if (!$nikename || !$email) //判斷是否為空 { echo '不能為空'; exit; } */ $sql="INSERT INTO shebeidangan (sb_name,sb_numandtype,sb_home,sb_usedate,sb_address,sb_updatetime,sb_remarks) VALUES ('$sb_name','$sb_numandtype','$sb_home','$sb_usedate','$sb_address','$sb_updatetime','$sb_remarks')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "ADD OK"; mysql_close($con) ?>
3.如果要修改 編輯器默認(rèn)字體大小的話,在編輯器UEditor目錄,ueditor.all.js文件里面查找“字體” ,就可以找到修改字號(hào)和字體的地方
以上所述就是本文的全部?jī)?nèi)容了,希望大家能夠喜歡。
相關(guān)文章
Yii實(shí)現(xiàn)顯示靜態(tài)頁(yè)的方法
這篇文章主要介紹了Yii實(shí)現(xiàn)顯示靜態(tài)頁(yè)的方法,結(jié)合實(shí)例形式分析了Yii框架顯示靜態(tài)頁(yè)的步驟與相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2016-04-04ThinkPHP調(diào)用百度翻譯類實(shí)現(xiàn)在線翻譯
這篇文章主要介紹了ThinkPHP調(diào)用百度翻譯類實(shí)現(xiàn)在線翻譯,需要的朋友可以參考下2014-06-06yii框架結(jié)合charjs實(shí)現(xiàn)統(tǒng)計(jì)30天數(shù)據(jù)的方法
這篇文章主要介紹了yii框架結(jié)合charjs實(shí)現(xiàn)統(tǒng)計(jì)30天數(shù)據(jù)的方法,涉及Yii框架日期運(yùn)算、數(shù)據(jù)查詢相關(guān)操作技巧,需要的朋友可以參考下2020-04-04詳解Grunt插件之LiveReload實(shí)現(xiàn)頁(yè)面自動(dòng)刷新(兩種方案)
這篇文章主要通過(guò)兩種方案詳解Grunt插件之LiveReload實(shí)現(xiàn)頁(yè)面自動(dòng)刷新,需要的朋友可以參考下2015-07-07php設(shè)計(jì)模式之代理模式分析【星際爭(zhēng)霸游戲案例】
這篇文章主要介紹了php設(shè)計(jì)模式之代理模式,結(jié)合星際爭(zhēng)霸游戲案例形式分析了PHP設(shè)計(jì)模式中代理模式的相關(guān)原理、使用方法與操作注意事項(xiàng),需要的朋友可以參考下2020-03-03php使HTML標(biāo)簽自動(dòng)補(bǔ)全閉合函數(shù)代碼
這個(gè)網(wǎng)上找到的自動(dòng)補(bǔ)全閉合函數(shù)還挺不錯(cuò)的,它可以根據(jù)你的html內(nèi)容自己補(bǔ)全閉合,確保HTMl代碼正確2012-10-10