PHP code example of tanzhenxing / ueditor-thinkphp

1. Go to this page and download the library: Download tanzhenxing/ueditor-thinkphp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tanzhenxing / ueditor-thinkphp example snippets


use Ueditor\Ueditor;

$ueditor = new Ueditor();

switch ($action) {
	case 'config':
        $result = $ueditor->getConfig();
        break;

    /* 上传图片 */
    case 'uploadimage':
    	$result = $ueditor->uploadImage()->saveImage();
    	break;
    /* 上传涂鸦 */
    case 'uploadscrawl':
    	$result = $ueditor->uploadImage()->saveScrawl();
    	break;
    /* 上传视频 */
    case 'uploadvideo':
    	$result = $ueditor->uploadImage()->saveVideo();
    	break;
    /* 上传文件 */
    case 'uploadfile':
        $result = $ueditor->uploadImage()->saveFile();
        break;

    /* 列出图片 */
    case 'listimage':
    	$start = array_get($params, 'start');
    	$size = array_get($params, 'size');
        $result = $ueditor->listImage()->getListImage($start, $size);
        break;
    /* 列出文件 */
    case 'listfile':
    	$start = array_get($params, 'start');
    	$size = array_get($params, 'size');
        $result = $ueditor->listFile()->getListFile($start, $size);
        break;

    /* 抓取远程文件 */
    case 'catchimage':
        $result = $ueditor->catchImage()->crawlerImage();
        break;

    default:
        $result = [
            'state'=> '请求地址出错'
        ];
        break;
}