An example analysis of automatic loading anomaly and repair method on thinkphp line _php instance

Source: Internet
Author: User
Tags php template smarty template

This article describes the automatic loading anomaly and the repair method on the thinkphp line. Share to everyone for your reference, specific as follows:

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

After testing, should be automatically loaded out of the problem, tried various methods,

1. Manual loading, found a good trouble, endless.

2. Write their own automatic loading, not write out, embarrassed.

3. Modify the configuration so that it supports automatic loading, found or not.

Later debugging,

Discover local support

Import (' @.org.oss\ossclient ');
Import (' @.org.oss\core\ossutil ');

On the server, the way that this slash is not supported is supported. The Way

Later, the thinkphp core code is adjusted.

Try searching
$paths =  explode (', ', C (' App_autoload_path ')) according to the automatic load path setting;
foreach ($paths as $path) {
  $class = str_replace ("\", ".", $class);
  Dump ($class);
  if (Import ($path. '. ') $class)) {
    //dump ($path. '. ') $class);
    Returns return if the Load class succeeds
    ;


After this little action, it's OK, the server can use OSS.

It's not easy!

More interested in thinkphp related content readers can view the site topics: "thinkphp Introductory Course", "thinkphp Template Operation Skills Summary", "thinkphp Common Methods Summary", "PHP commonly used functions and skills summary", " Smarty Template Basics Tutorial and PHP template technology summary.

I hope this article will help you with the PHP program design based on thinkphp framework.

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.