ThinkPHP online automatic loading exception and Repair Method Instance analysis, thinkphp instance analysis

Source: Internet
Author: User

ThinkPHP online automatic loading exception and Repair Method Instance analysis, thinkphp instance analysis

This article describes thinkPHP online automatic loading exceptions and solutions. We will share this with you for your reference. The details are as follows:

The project encountered a strange problem. The local code is normal, but the server is not normal.

After testing, the problem should be caused by automatic loading, and various methods have been tried,

1. Manual loading, which is troublesome and endless.

2. Write it automatically and load it by yourself.

3. modify the configuration so that it can be loaded automatically.

Later debugging,

Local Support discovered

Import ('@. ORG. OSS \ OssClient'); import ('@. ORG. OSS \ Core \ OssUtil ');

The server does not support this slash, but does.

Later, we adjusted thinkphp's core code.

// Search for $ paths = explode (',', C ('app _ AUTOLOAD_PATH '); foreach ($ paths as $ path) based on the automatic loading path settings) {$ class = str_replace ("\\",". ", $ class); // dump ($ class); if (import ($ path. '. '. $ class) {// dump ($ path. '. '. $ class); // return if the class is successfully loaded ;}}

After this small action, you can use OSS on the server.

Not easy!

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.