The thinkphp A (), R () method cannot invoke the reason for a controller that is the same as the current action name across the project

Source: Internet
Author: User

thinkphp when using the A () and R () methods to cross-project calls, you cannot invoke an action class in another project that has the same name as the currently active action class.

The following is common. Php,import () method 308-312 Line

[PHP]View PlainCopy
    1. $classfile = $baseUrl . $class . $ext;
    2. if (!class_exists (basename ($class), false)) {
    3. Import the class library file if the class does not exist
    4. Return Require_cache ($classfile);
    5. }

In line 2nd here, the Class_exists () method is used to determine if the class that needs to be loaded exists, and if it does not, import the class library file, which is the action class file that imports another project.

The 2nd parameter of Class_exists () is false, it will not __autoload (), that is, the current file will only find the existence of the class, in general, is not found, so you can proceed to the next sentence.

However, if you invoke an action class with the same name as the current action class in another project, this sentence will assume that the action class you want already exists, that is, the action of the current operation, because the class name is the same. The system then returns the current action class

The thinkphp A (), R () method cannot invoke the reason for a controller that is the same as the current action name across the project

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.