Install and use laravel-u-editor by composer, and use composer by laravel.
Preface
The framework used is laravel5.1, which is built by composer. You can directly configure composer. If it is not set up by composer, you need to install composer first. For details about the installation and release, refer to the composer official website of China,
It is best to configure a Chinese Image in China. Otherwise, it is likely that the download of resources will fail and various problems will occur.
Install composer
1. Configure the composer. json file and add it to the require in the composer. json File
"stevenyangecho/laravel-u-editor": "~1.4"
2. Run composer update or composer install on the command card (this can be used to run global variables that require composer configuration anywhere)
Composer update or run composer install
Without an accident, you will be downloading the files required by the rich text editor, as well as other unexpected situations, such as php extension problems,
This is a fileinfo extension used to upload rich text files. If it is not installed, you only need to install it in php. remove the semicolon comment before the extension in the INI file and restart the service.
extension=php_fileinfo.dll
3. Configure the config/app. php file
Add
Stevenyangecho\UEditor\UEditorServiceProvider::class
Add
'UEditor'=>Stevenyangecho\UEditor\UEditorServiceProvider::class
4. register the tool interface and run it on the command line
php artisan vendor:publish
The laravel-u-editor Rich Text editor has been installed. You can go to the config directory of the project to check whether it is UEditorUpload. php file. This is the configuration file of the Rich Text Editor. You can configure the File Upload path.
5. Use the editor
① Introduce in the view
<div id="ueditor" class="edui-default"> @include('UEditor::head')</div>
② Add the following code where the editor is needed
<div id="ueditor" class="edui-default"> @include('UEditor::head')</div>
③ Add the js file and add the following code at the end of the View
@ Section ('script') <script id = "ueditor"> </script> <script> var ue = UE. getEditor ("ueditor"); ue. ready (function () {// because Laravel has anti-csrf attack processing, add the ue.exe cCommand ('serverparam', '_ token ', '{{ csrf_token () }}') ;}); </script> @ stop