Home > Backend Development > PHP Tutorial > 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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-12 08:54:24
Original
1010 people have browsed it

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;>

Copy after login

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...
Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template