: 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.