国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

CKEditor && CKFinder 配置

2019-11-15 01:20:54
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
CKEditor && CKFinder 配置

準(zhǔn)備

  CKEditor&&CKFinder破解版百度網(wǎng)盤(pán)地址:http://pan.baidu.com/s/1qWsDPKC 密碼:yydcdut

   

  將CKEditor和CKFinder放在同一文件夾下。

CKEditor實(shí)現(xiàn)編輯框

  CKEditor 實(shí)際是替換一個(gè)textarea標(biāo)簽,所以把textarea放到一個(gè)form表單中,當(dāng)提交到php服務(wù)器端,使用$_POST['xxx'] 取得編輯好的數(shù)據(jù)。

  修改CKEditor的配置文件config.js

1 CKEDITOR.editorConfig = function( config )2 {3     config.language = 'zh-cn';4     config.uiColor = '#FFA';5     config.skin = 'v2';6     config.width = 850;7     config.height = 400;8     config.toolbar = 'Full';9 };

  一個(gè)簡(jiǎn)單的網(wǎng)頁(yè)實(shí)現(xiàn)

 1 <html> 2 <head> 3     <meta http-equiv="Content-type" content="text/html; charset=UTF-8"> 4     <title>yyd</title> 5 </head> 6 <body> 7     <form action="post.php" method="post"> 8         <textarea name="editor1">yyd</textarea> 9         <input type="submit" name="submit" value="Submit" />10     </form>11 </body>12 13 <script src="ckeditor/ckeditor.js"></script>14 <script type="text/javascript">15     // 啟用 CKEitor 的上傳功能,使用了 CKFinder 插件16     CKEDITOR.replace( 'editor1', {17         filebrowserBrowseUrl        : 'ckfinder/ckfinder.html',18         filebrowserImageBrowseUrl   : 'ckfinder/ckfinder.html?Type=Images',19         filebrowserFlashBrowseUrl   : 'ckfinder/ckfinder.html?Type=Flash',20         filebrowserUploadUrl   : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',21         filebrowserImageUploadUrl   : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',22         filebrowserFlashUploadUrl   : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'23     });24 </script>25 </html>

  實(shí)現(xiàn)截圖

        

CKFinder實(shí)現(xiàn)上傳圖片

  • 在與CKEditor和CKFinder同目錄下創(chuàng)建uploads文件夾
  • 改修config.php文件

  第21行的函數(shù)

 1 function CheckAuthentication() 2 { 3     // WARNING : DO NOT simply return "true". By doing so, you are allowing 4     // "anyone" to upload and list the files in your server. You must implement 5     // some kind of session validation here. Even something very simple as... 6  7     // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized']; 8  9     // ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the10     // user logs in your system. To be able to use session variables don't11     // forget to add session_start() at the top of this file.12 13     //return false;14     return true;15 }

  第66行,即修改為創(chuàng)建的uploads路徑

1 $baseUrl = '/CK/plugins/uploads/';

  實(shí)現(xiàn)截圖

    

  創(chuàng)建post.php文件,將傳遞過(guò)來(lái)的POST打印出來(lái)

1 <?php2 header("Content-Type:text/html; charset=utf-8");3 $str = $_POST['editor1'];4 $data = stripslashes(htmlspecialchars_decode($str));5 echo $data;6 ?>

    

總結(jié)和問(wèn)題的解決

  當(dāng)我配置完成后,submit提交之后死活都不能顯示圖片,查看源代碼的時(shí)候,發(fā)現(xiàn)雙引號(hào)被轉(zhuǎn)義了,覺(jué)得很蛋疼。我不知道這個(gè)CKEditor轉(zhuǎn)義的還是瀏覽器轉(zhuǎn)義的,因?yàn)榫驮谇皫滋欤以跍y(cè)試SQL注入的時(shí)候就發(fā)現(xiàn)明明可以注入的,但死活不出來(lái)結(jié)果,然后在本機(jī)上將passWord傳遞過(guò)去的值打印出來(lái)了,發(fā)現(xiàn)是被轉(zhuǎn)義了,表示很蛋疼。所以我在這里用了$data = stripslashes(htmlspecialchars_decode($str));將轉(zhuǎn)義之后再反轉(zhuǎn)義湖區(qū),結(jié)果就OK了。

  CKEditor&&CKFinder組合不僅可以上傳圖片,還可以上傳文件等。

轉(zhuǎn)載請(qǐng)注明出處:http://www.survivalescaperooms.com/yydcdut/p/3518102.html


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 桐城市| 方正县| 青州市| 突泉县| 万源市| 建昌县| 武功县| 加查县| 南郑县| 临泉县| 泉州市| 凭祥市| 郑州市| 巴塘县| 宜良县| 江源县| 黔江区| 五常市| 宜州市| 泗洪县| 金秀| 陇西县| 岳普湖县| 贵州省| 白河县| 苏尼特左旗| 芦山县| 红桥区| 庐江县| 祁阳县| 康乐县| 海淀区| 连州市| 太谷县| 成武县| 贵州省| 淳化县| 五家渠市| 凌海市| 滨海县| 兰溪市|