Home  >  Article  >  Backend Development  >  A simple solution to the conflict between __autoload and Smarty in PHP, __autoloadsmarty_PHP tutorial

A simple solution to the conflict between __autoload and Smarty in PHP, __autoloadsmarty_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:54:24957browse

A simple solution to the conflict between __autoload and Smarty in PHP, __autoloadsmarty

This article describes a simple solution to the conflict between __autoload and Smarty in PHP. Share it with everyone for your reference, the details are as follows:

1. Question:

Recently, it was discovered in the project that PHP's __autoload method is invalid. After debugging for a long time, I couldn't figure it out. After checking the information, I found out that it was Smarty. The new version of Smarty has changed the way autoload is done.

2. Solution:

Add a piece of code after Smarty’s included class file, spl_autoload_register("__autoload");

is as follows:

<&#63;php
  define('ROOT_PATH', dirname(__FILE__));
  require_once ROOT_PATH . '/includes/smarty/Smarty.class.php';
  spl_autoload_register("__autoload"); // 添加这段代码
&#63;>

Readers who are interested in more PHP-related content can check out the special topics of this site: "Basic Tutorial for Getting Started with Smarty Templates", "Summary of PHP Template Technology", "Summary of PHP Database Operation Skills Based on PDO", "PHP Operations and Operators" Usage summary", "PHP network programming skills summary", "PHP basic syntax introductory tutorial", "php object-oriented programming introductory tutorial", "php string (string) usage summary", "php mysql database operation introductory tutorial" and "Summary of Common Database Operation Skills in PHP"

I hope this article will be helpful to everyone’s PHP program design based on smarty templates.

Articles you may be interested in:

  • thinkphp autoload namespace custom namespace
  • Detailed explanation of spl_autoload in php
  • Instance analysis of PHP’s autoload operating mechanism
  • Autoload of PHP dependency management tool Composer
  • Analysis of the difference between spl_autoload_register() and __autoload() in PHP
  • Summary of the usage of autoload in PHP
  • In-depth understanding of PHP autoload and spl_autoload automatic loading mechanism
  • Talk about PHP’s autoLoad automatic loading mechanism
  • Implementation analysis of PHP’s autoload mechanism
  • PHP How to use the __autoload function (automatic loading of class files)
  • Usage of the PHP function spl_autoload_register() and introduction to __autoload()
  • Analysis of PHP file caching smarty template application examples
  • Detailed explanation of how to use Smarty template in php

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1119986.htmlTechArticleA simple solution to the conflict between __autoload and Smarty in PHP, __autoloadsmarty This article tells about the conflict between __autoload and Smarty in PHP Simple solution. Share it with everyone for your reference, specifically...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn