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.