When ueditor solve cross-domain requests can not upload pictures and picture list echo path problem

You can skip directly to see the focus back

1, the test environment:

 1. The back-end deployment based on Win10 + Wampserver64

 2. debugging tools based Hbuilder

2, set up a test environment

  1. Download ueditor Source  https://ueditor.baidu.com/website/download.html

e0bfdd6b547dee09478bcb4a5bdd53cf0b6.jpg

 2. After downloading the file decompression, php folder to the installation path of wampserver www / ueditor / folder

7fa7ea5a41f2a755e4f45ab1db009d2b5da.jpg

65217cd86cdb5c53d8b90abce0761486a51.jpg

3. Start wampserver default start port is port 80 (the test was modified to 8080)

9d1b2076425e3397f7414c95bf7beec7521.jpg

4, testing the background service is started successfully, open your browser and enter the address below, to get to the configuration file, indicating that the background service is started successfully.

http://127.0.0.1:8080/ueditor/php/controller.php?action=config#

a553f2b648eb442ec59d85f4ce75faa2b48.jpg

3, based debugging Hbuilder

1. In decompression ueditor Hbuilder source after opening, the directory structure is as follows:

b37a6b917047504ad7c35c1e309b014d18b.jpg

Key 1: Modify ueditor.config.js will serverUrl to the address of your own server:

serverUrl: "http://127.0.0.1:8080/ueditor/" + "php/controller.php"

Key 2: Modify D: \ wamp64 \ www \ ueditor \ php \ config.json configuration picture access path prefix, both involving the prefix plus: http: //127.0.0.1: 8080

5bab2121d3e086873b86d581c8099f24353.jpg

Priority 3: Modify D: \ wamp64 \ www \ ueditor \ php \ controller.php Cancel notes below, will  http://www.baidu.com changed to *

header('Access-Control-Allow-Origin: *'); //设置允许跨域访问
header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With'); //设置允许的跨域header

4, test shots.

Upload:

ff643d20947528fac1ce034afe4070c7816.jpg

echo:

d82ab2eccd9e0b77361f06c796a8d5b41c7.jpg

Reference: http://fex.baidu.com/ueditor/

Reproduced in: https: //my.oschina.net/zhenggao/blog/3056642

Guess you like

Origin blog.csdn.net/weixin_34247032/article/details/92034925