A simple workaround for __autoload and smarty conflicts in PHP, __autoloadsmarty_php tutorial

Source: Internet
Author: User
Tags autoload php template smarty template

A simple workaround for __autoload and smarty conflicts in PHP, __autoloadsmarty


This article describes the simple workarounds for __autoload and smarty conflicts in PHP. Share to everyone for your reference, as follows:

First, the question:

Recently, it was found in the project that PHP's __autoload method failed. Debugging for a long time, think not its solution, check the information before we know the original is the reason for Smarty. The new version of Smarty changed the way autoload.

Second, the solution:

Add a section of code after the Smarty containing class file, Spl_autoload_register ("__autoload");

As follows:

<?php  define (' Root_path ', DirName (__file__));  Require_once Root_path. '/includes/smarty/smarty.class.php ';  Spl_autoload_register ("__autoload"); Add this piece of code?>

More about PHP related content readers can view the topic: "Smarty Template Primer Basic Tutorial", "PHP Template Technology Summary", "PHP based on PDO Operation Database Skills summary", "PHP operation and operator Usage Summary", "PHP Network Programming Skills Summary", " PHP Basic Grammar Introductory tutorial, PHP Object-oriented Programming primer, PHP string usage Summary, PHP+MYSQL database Operations Primer and PHP Common database operations Tips Summary

It is hoped that this article will be helpful to everyone based on smarty template PHP program design.

Articles you may be interested in:

    • thinkphp AutoLoad Namespace Customization namespace
    • PHP in Spl_autoload detailed
    • A case analysis of PHP's autoload operation mechanism
    • PHP Management Dependency (dependency) Relationship Tool Composer Auto-load (autoload)
    • Spl_autoload_register () and __autoload () difference analysis in PHP
    • Summary of usage of autoload in PHP
    • An in-depth understanding of PHP AutoLoad and spl_autoload automatic loading mechanism
    • Talk about PHP's autoload automatic loading mechanism
    • Implementation of PHP's autoload mechanism
    • How to use PHP __autoload functions (automatic loading of class files)
    • php function Spl_autoload_register () usage and __autoload () Introduction
    • PHP file Cache smarty Template Application Example Analysis
    • PHP smarty Template Usage Example detailed

http://www.bkjia.com/PHPjc/1119986.html www.bkjia.com true http://www.bkjia.com/PHPjc/1119986.html techarticle A simple workaround for __autoload and Smarty conflicts in PHP, __autoloadsmarty This article describes a simple workaround for __autoload and smarty conflicts in PHP. Share to everyone for your reference, specific as ...

  • 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.