摘要:集成推薦使用,它是的版本。七牛分配的域名注意帶上修復(fù)上傳界面中無(wú)法管理文件列表的問(wèn)題注釋掉下面的行下面三行是修改的如果不取到,報(bào)找不到的錯(cuò)誤判斷是否錯(cuò)誤返回?cái)?shù)據(jù)
laravel-admin集成ueditor推薦使用laravel-u-editor,它是ueditor的laravel composer版本?;赨Editor 1.4.3.3開(kāi)發(fā),支持en、zh_CN、zh_TW,并且支持本地和七牛云存儲(chǔ),默認(rèn)為本地上傳 public/uploads
安裝composer require stevenyangecho/laravel-u-editor 然后在config/app.php的providers下增加一行 StevenyangechoUEditorUEditorServiceProvider::class 執(zhí)行 php artisan vendor:publish基本配置
1.增加組件文件:app/Admin/Extensions/Form/uEditor.php: script = << @include("admin::form.error") {{-- 這個(gè)style可以限制他的高度,不會(huì)隨著內(nèi)容變長(zhǎng) --}} @include("admin::form.help-block")
打開(kāi)文件configUEditorUpload.php配置七牛配置參數(shù) // 將下一行注釋 // "mode"=>"local",//上傳方式,local 為本地 qiniu 為七牛 "mode"=>"qiniu",//上傳方式,local 為本地 qiniu 為七牛 //七牛配置,若mode="qiniu",以下為必填. "qiniu"=>[ "accessKey"=>"。。。", "secretKey"=>"。。。", "bucket"=>"。。。", "url"=>"。。。",//七牛分配的CDN域名,注意帶上http:// ] ],修復(fù)上傳界面中無(wú)法管理文件列表的問(wèn)題
vendorstevenyangecholaravel-u-editorsrcListsQiniu.php public function getList() { $size = $this->request->get("size", $this->listSize); $start = $this->request->get("start", ""); $auth = new Auth(config("UEditorUpload.core.qiniu.accessKey"), config("UEditorUpload.core.qiniu.secretKey")); $bucketManager = new BucketManager($auth); // 注釋掉下面的行 // list($items, $marker, $error) = $bucketManager->listFiles(config("UEditorUpload.core.qiniu.bucket"), $this->path, $start, $size); // 下面三行是修改的 $result1 = $bucketManager->listFiles(config("UEditorUpload.core.qiniu.bucket"), $this->path, $start, $size); $size = count($result1); // 如果不取到items,報(bào)找不到key的錯(cuò)誤 $items = $result1[0]["items"]; // 判斷是否錯(cuò)誤 if ($size > 2) { return [ "state" => $error->message(), "list" => array(), "start" => $start, "total" => 0 ]; } if(empty($items)){ return [ "state" => "no match file", "list" => array(), "start" => $start, "total" => 0 ]; } $files=[]; // dd($items["items"]); foreach ($items as $v) { if (preg_match("/.(" . $this->allowFiles . ")$/i", $v["key"])) { $files[] = array( "url" =>rtrim(config("UEditorUpload.core.qiniu.url"),"/")."/".$v["key"], "mtime" => $v["mimeType"], ); } } if(empty($files)){ return [ "state" => "no match file", "list" => array(), "start" => $start, "total" => 0 ]; } /* 返回?cái)?shù)據(jù) */ $result = [ "state" => "SUCCESS", "list" => $files, "start" => $start, "total" => count($files) ]; return $result; }
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/28818.html
摘要:為每一個(gè)中創(chuàng)建一個(gè)能夠自動(dòng)生成的的方法就可以了。例如為這個(gè)創(chuàng)建生成的方法獲取用戶列表在對(duì)應(yīng)的控制器中使用比如的控制器中標(biāo)題摘要簡(jiǎn)介正文作者略文檔中說(shuō)的使用接口方式,而且返回文檔中的格式,是不能解決自動(dòng)選中原值的,只能是空白的。 為每一個(gè)Model中創(chuàng)建一個(gè)能夠自動(dòng)生成select的option的方法就可以了。 例如為User.php這個(gè)model創(chuàng)建生成option的方法 /*...
摘要:前言因?yàn)轫?xiàng)目需求,需要把圖片上傳至阿里云,我的接口和后臺(tái)項(xiàng)目是分開(kāi)的,都使用的框架開(kāi)發(fā),接入這里就不做討論了,這里主要說(shuō)一下上傳阿里的問(wèn)題。 前言 因?yàn)轫?xiàng)目需求,需要把圖片上傳至阿里云 OSS,我的 Api 接口和后臺(tái)項(xiàng)目是分開(kāi)的,都使用的 laravel 框架開(kāi)發(fā),Api 接入 OSS 這里就不做討論了,這里主要說(shuō)一下 laravel-admin 上傳阿里 OSS 的問(wèn)題。 網(wǎng)上的一...
閱讀 3637·2021-11-24 10:22
閱讀 3705·2021-11-22 09:34
閱讀 2510·2021-11-15 11:39
閱讀 1541·2021-10-14 09:42
閱讀 3676·2021-10-08 10:04
閱讀 1570·2019-08-30 15:52
閱讀 863·2019-08-30 13:49
閱讀 3032·2019-08-30 11:21