How to integrate Baidu UE (ueditor1.4.3) in PHP)

Source: Internet
Author: User
: This article mainly introduces how to integrate Baidu UE (ueditor1.4.3) in PHP. For more information about PHP tutorials, see. How to integrate Baidu UE in PHP (ueditor 1.4.3)

Recently, many blogs have asked me how to integrate Baidu UE (ueditor 1.4.3). I can't answer this question, so here I will write the idea of integrating Baidu UE, the latest version UE1.4.3 used in this article.

Download and Install

1. first download the latest UE1.4.3 from the official website.

UE official: http://ueditor.baidu.com/website/download.html#ueditor

Here I downloaded the 1.4.3PHP version. Download the version you are using.

Decompress the file to your project.

2. Deployment. introduce the JS file required by UE on the front-end Html page, and then instantiate it using getEditor.

 
   
   
   
   

View your page to see Ueditor. Is it easy to say.

Configure Ueditor

UEditor configuration items are divided into two types: front-end configuration items and backend configuration items.

The frontend and backend configurations are uniformly written in the backend (PHP-version config is in php/config. json). when the editor is instantiated, the backend configuration information is asynchronously read and overwritten in the frontend configuration.

Backend configuration items> instantiated input configuration items> configuration items of ueditor. config. js files

Frontend configuration items: two official configuration methods are available: static configuration and dynamic configuration.

Static Configuration: configure ueditor. config. js under the ueditor directory specific configuration items refer to http://fex-team.github.io/ueditor/#start-config

Dynamic Configuration: When the UE is instantiated, the configuration parameters are passed in dynamically.

Var ue = UE. getEditor ('container', {// here write your custom configuration item toolbars: [['fullscreen ', 'source', 'Undo', 'redo ', 'bold '], autoHeightEnabled: true, autoFloatEnabled: true });

Backend configuration items:

Here, let's talk about the UE request: all the operations of UE are to request serverUrl through get to pass the value of the action variable for the next operation. Other operations such as configuration acquisition, image uploading, and image retrieval.

By default, UE reads the serverUrl parameter in ueditor. config. js in the directory and passes action = config through the get method to obtain the backend configuration items. The default request is: serverUrl? Action = config. ServerUrl can be dynamically configured on the front-end page and static configuration of ueditor. config. js.

Can you test the path ueditor/php/controller. php under your website? Whether action = config returns the backend configuration content in json format (other formats are acceptable. for details, see the official documentation). The format is roughly as follows. If a request error occurs, such as 400 or 500, the editor Upload functions will not work properly.

{"ImageUrl": "http: // localhost/ueditor/php/controller. php? Action = uploadimage "," imagePath ":"/ueditor/php/"," imageFieldName ":" upfile "," imageMaxSize ": 2048," imageAllowFiles ":[". png ",". jpg ",". jpeg ",". gif ",". bmp "]" other configuration items... ":" Other configuration values... "}

Integration

As mentioned above, all operations of UE are requested to pass the value of action variable to serverUrl in get mode for the next operation. Other operations such as configuration acquisition, image uploading, and image retrieval. Understand this and integrate PHP. Or other languages. For specific code, refer to the official Demo.

The above describes how to integrate Baidu UE (ueditor 1.4.3) in PHP, including Baidu UE content, and hope to help friends who are interested in PHP tutorials.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.