Thinkphp3.2.3 how to automatically load the package in composer?

Source: Internet
Author: User
Hello, I am using the encryption package composerrequireucsdmathencryption in thinkphp3.2.3 and introduced require & #039; in the entrance file ;. vendorautoload. php & #039; In ApplicationHomeControllerIndexController. class. u... is also added to php...

Hello, in thinkphp3.2.3, I used the composer require ucsdmath/encryption package and introduced require './vendor/autoload. php' in the entry file ';

Use UCSDMathEncryptionEncryption is also added to ApplicationHomeControllerIndexController. class. php;

However, in the instantiation, $ encryption = new Encryption ('hello ');

This is my directory structure:

Reply content:

Hello, in thinkphp3.2.3, I used the composer require ucsdmath/encryption package and introduced require './vendor/autoload. php' in the entry file ';

Use UCSDMathEncryptionEncryption is also added to ApplicationHomeControllerIndexController. class. php;

However, in the instantiation, $ encryption = new Encryption ('hello ');

This is my directory structure:

Ask the same question ..
Https://segmentfault.com/q/1010000005272111

Try to import it before placing it in the entry file

It should be caused by the location of the imported file.
Modified according to the package you needcomposer.jsonAs follows:

Thencomposer updateThen, the modified entry file

Modify the IndexController. class. php file

The result is as follows:

From this error, it is obvious that the class you need has already been introduced, but unfortunately, I will not use this class, so an error is reported!

Hope this will help you.

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.