search
Homephp教程php手册黄永成老师thinkphp视频教程ueditor最新版本使用

视频教程上的ueditor和最新版本不太一样,今天弄了好长时间,终于可以成功上传了。现在给大家分享一下。
配置项处做一下修改,如下:<script><br /> window.UEDITOR_HOME_URL = &#039;__ROOT__/Data/Ueditor/&#039;;<br /> window.onload = function () {<br /> window.UEDITOR_CONFIG.initialFrameWidth = 1200;<br /> window.UEDITOR_CONFIG.initialFrameHeight = 600;<br /> window.UEDITOR_CONFIG.serverUrl = "{:U(GROUP_NAME.&#039;/Blog/upload&#039;)}";<br /> UE.getEditor(&#039;content&#039;);<br /> }<br /> <br /> </script>upload()做了较大的修改,主要是把新版本ueditor的controller.php文件复制过来进行了一下修改。//编辑器图片上传处理<br>     public function upload () {<br>         date_default_timezone_set("Asia/chongqing");<br>         error_reporting(E_ERROR);<br>         header("Content-Type: text/html; charset=utf-8");<br>         <br>         $CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents("./Data/Ueditor/php/config.json")), true);<br>         $action = $_GET['action'];<br>         switch ($action) {<br>             case 'config':<br>                 $result =  json_encode($CONFIG);<br>                 break;<br>         <br>                 /* 上传图片 */<br>             case 'uploadimage':<br>                 /* 上传涂鸦 */<br>             case 'uploadscrawl':<br>                 /* 上传视频 */<br>             case 'uploadvideo':<br>                 /* 上传文件 */<br>             case 'uploadfile':<br>                 //$result = include("action_upload.php");<br>                 import('ORG.Net.UploadFile');<br>                 $upload = new UploadFile();<br>                 $upload->autoSub = true;<br>                 $upload->subType = 'date';<br>                 $upload->dateFormat = 'Ym';<br>                 if ($upload->upload('./Uploads/')){<br>                     $info = $upload->getUploadFileInfo();<br>                     echo json_encode(array(<br>                             'url'        =>    __ROOT__.'/Uploads/'.$info[0]['savename'],<br>                             'title'        =>    htmlspecialchars($_POST['pictitle'], ENT_QUOTES),<br>                             'original'    =>    $info[0]['name'],<br>                             'state'        =>    'SUCCESS'<br>                             ));<br>                     <br>                 }else{<br>                     echo json_encode(array(<br>                             'state'    => $upload->getErrorMsg(),<br>                             ));<br>                 }<br>                 break;<br>         <br>                 <br>         }<br>         <br>         /* 输出结果 */<br>         if (isset($_GET["callback"])) {<br>             if (preg_match("/^[\w_]+$/", $_GET["callback"])) {<br>                 echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';<br>             } else {<br>                 echo json_encode(array(<br>                         'state'=> 'callback参数不合法'<br>                 ));<br>             }<br>         } else {<br>             echo $result;<br>         }<br>     }这样上传图片就正常了,大家试一下,如果有问题可以留言共同讨论。

AD:真正免费,域名+虚机+企业邮箱=0元

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software