Home > Backend Development > PHP Tutorial > Resolve __autoload and Smarty conflicts in PHP_PHP Tutorial

Resolve __autoload and Smarty conflicts in PHP_PHP Tutorial

WBOY
Release: 2016-07-13 17:47:53
Original
945 people have browsed it

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 changes the way autoload is performed.


The solution is: add a piece of code after Smarty’s included class file, spl_autoload_register("__autoload");

as follows:

Define('ROOT_PATH', dirname(__FILE__));
require_once ROOT_PATH . '/includes/smarty/Smarty.class.php';
spl_autoload_register("__autoload"); // Add this code
?>

Excerpted from Lee.’s column

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478466.htmlTechArticleRecently, it was discovered in the project that PHP's __autoload method failed. 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 changes...
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template