Smarty_编译器.class.php错误
致命错误:无法在第35行的/home/raining/public_html/quadhits/libs/Smarty-2.6.26/Smarty_Compiler.class.php中重新声明类Smarty_编译器。这是什么意思Smarty_编译器.class.php错误,php,Php,致命错误:无法在第35行的/home/raining/public_html/quadhits/libs/Smarty-2.6.26/Smarty_Compiler.class.php中重新声明类Smarty_编译器。这是什么意思 /* $Id: Smarty_Compiler.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */ /** * Template compiling class * @package Smarty *
/* $Id: Smarty_Compiler.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */
/**
* Template compiling class
* @package Smarty
*/
class Smarty_Compiler extends Smarty { -------------- this is line 35
// internal vars
/**#@+
* @access private
*/
var $_folded_blocks = array(); // keeps folded template blocks
var $_current_file = null; // the current template being compiled
var $_current_line_no = 1; // line number for error messages
var $_capture_stack = array(); // keeps track of nested capture buffers
var $_plugin_info = array(); // keeps track of plugins to load
var $_init_smarty_vars = false;
var $_permitted_tokens = array('true','false','yes','no','on','off','null');
var $_db_qstr_regexp = null; // regexps are setup in the constructor
var $_si_qstr_regexp = null;
var $_qstr_regexp = null;
var $_func_regexp = null;
var $_reg_obj_regexp = null;
这意味着您的类已经在其他地方声明,您正在尝试再次声明它。确保不包含两次包含此类的同一文件 一个快速的解决方案是将类包装在这个IF语句中。你应该经常使用它来避免任何类似于你所遇到的问题
<?php
if(class_exists('Smarty_Compiler') === FALSE){
// Your class here
class Smarty_Compiler extends Smarty {
// ...
}
}
?>
或者根据您的程序标记样式
<?php
if(!class_exists('Smarty_Compiler')){
// Your class here
class Smarty_Compiler extends Smarty {
// ...
}
}
?>
我知道在第35行上方添加IF语句的位置,并将最后一个}
放在课程结束后