1

致命的なエラー: 行 35 の /home/rainingt/public_html/quadhits/libs/Smarty-2.6.26/Smarty_Compiler.class.php でクラス Smarty_Compiler を再宣言できません。これはどういう意味ですか?

/* $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;
4

1 に答える 1

2

これは、クラスが別の場所で既に宣言されていて、再度宣言しようとしていることを意味します。このクラスを含む同じファイルを 2 回含めないようにしてください。

簡単な解決策は、この 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 {

        // ...

    }
}

?>
于 2013-09-20T16:15:41.777 に答える