Heim > php教程 > php手册 > Hauptteil

PHP中__autoload和Smarty冲突的简单解决方法,__autoloadsmarty

WBOY
Freigeben: 2016-06-13 08:41:52
Original
922 Leute haben es durchsucht

PHP中__autoload和Smarty冲突的简单解决方法,__autoloadsmarty

本文讲述了PHP中__autoload和Smarty冲突的简单解决方法。分享给大家供大家参考,具体如下:

一、问题:

最近,在项目中发现,PHP 的 __autoload 方法失效了。调试了好久,百思不得其解,查了下资料才知道原来是 Smarty 的原因。新版的 Smarty 改变了autoload的方式。

二、解决方法:

在 Smarty 的包含类文件后加一段代码,spl_autoload_register("__autoload");

如下:

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

Nach dem Login kopieren

更多关于PHP相关内容感兴趣的读者可查看本站专题:《smarty模板入门基础教程》、《PHP模板技术总结》、《PHP基于pdo操作数据库技巧总结》、《PHP运算与运算符用法总结》、《PHP网络编程技巧总结》、《PHP基本语法入门教程》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》

希望本文所述对大家基于smarty模板的PHP程序设计有所帮助。

您可能感兴趣的文章:

  • thinkphp autoload 命名空间自定义 namespace
  • php中spl_autoload详解
  • PHP之autoload运行机制实例分析
  • PHP管理依赖(dependency)关系工具 Composer的自动加载(autoload)
  • PHP中spl_autoload_register()和__autoload()区别分析
  • php中autoload的用法总结
  • PHP autoload与spl_autoload自动加载机制的深入理解
  • 说说PHP的autoLoad自动加载机制
  • PHP的autoload机制的实现解析
  • PHP __autoload函数(自动载入类文件)的使用方法
  • PHP函数spl_autoload_register()用法和__autoload()介绍
  • PHP文件缓存smarty模板应用实例分析
  • php之Smarty模板使用方法示例详解
Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!