Fatal error: Uncaught exception 'SmartyException' with message '{include_php} is deprecated, use SmartyBC class to enable' in D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_compile_include_php.php:52 Stack trace: #0 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php(473): Smarty_Internal_Compile_Include_Php->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL) #1 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php(247): Smarty_Internal_TemplateCompilerBase->callTagCompiler('include_php', Array, Array) #2 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templateparser.php(2393): Smarty_Internal_TemplateCompilerBase->compileTag('include_php', Array) #3 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templateparser.php(3096): Smarty_Internal_Templateparser->yy_r36() #4 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templateparser.php(3196): Smarty_Internal_Templateparser->yy_reduce(36) #5 D:\php5\includes\ in D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_compile_include_php.php on line 52
以上为错误代码。为什么说include_php不行,用SmartyBC类。那么用这个类中的哪个方法可以代替?就算用{php}echo "hello"{/php}这个语句都出错:Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "D:\php5\includes\Smarty\demo\templates\header.tpl" on line 18 "<center><h2>this is the header.tpl here - {php}echo "hello"{/php}</h2></center>" unknown tag "php"' in D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php:656 Stack trace: #0 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php(441): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "ph...', 18) #1 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templateparser.php(2398): Smarty_Internal_TemplateCompilerBase->compileTag('php', Array) #2 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templateparser.php(3096): Smarty_Internal_Templateparser->yy_r37() #3 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templateparser.php(3196): Smarty_Internal_Templateparser->yy_reduce(37) #4 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal in D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 656

解决方案 »

  1.   

    {include_php}  方法已经废弃  建议你用iframe吧.
      

  2.   

    错误信息写着unknown。应该是楼上的答案了。
      

  3.   

    Smarty 不是向下兼容的
    如果你盲目的从 Smarty2 升级到 Smarty3,那你就需要自行承担无知的后果Smarty2 的模板在 Smarty2 下加载
    Smarty3 的模板在 Smarty3 下加载
    不要搞混淆了
      

  4.   


    但为什么用{php}echo "hello"{/php}这个语句也出错?难道这个语句也废弃了?
      

  5.   


    在Smarty3中不能识别$smarty->allow_php_tag = true怎么办?