在smarty模版中使用php代码时,section能正常使用,但是使用php时提示我smarty\plugins\block.php.php on line 22有问题。怎么解决啊!!!

解决方案 »

  1.   

    Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "D:/zhongyaowemjian/huanjing/wamp/www\1\system\templates/index.tpl" on line 19 "" unclosed {php} tag' in D:\zhongyaowemjian\huanjing\wamp\www\1\system\smarty\sysplugins\smarty_internal_templatecompilerbase.php:423 Stack trace: #0 D:\zhongyaowemjian\huanjing\wamp\www\1\system\smarty\sysplugins\smarty_internal_smartytemplatecompiler.php(64): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unclosed {php} ...') #1 D:\zhongyaowemjian\huanjing\wamp\www\1\system\smarty\sysplugins\smarty_internal_templatecompilerbase.php(82): Smarty_Internal_SmartyTemplateCompiler->doCompile('<!DOCTYPE html ...') #2 D:\zhongyaowemjian\huanjing\wamp\www\1\system\smarty\sysplugins\smarty_internal_template.php(259): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Smarty_Internal_Template)) #3 D:\zhongyaowemjian\huanjing\wamp\www\1\system\smarty\sysplugins\smarty_internal_template.php(402): Smarty_Internal_Template->compileTemp in D:\zhongyaowemjian\huanjing\wamp\www\1\system\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 423
      

  2.   

    <?php
    /*  定义服务器的绝对路径  */
    define('BASE_PATH',$_SERVER['DOCUMENT_ROOT']);
    /*  定义Smarty目录的绝地你路径  */
    define('SMARTY_PATH','\1\system\smarty\\');
    /*  加载Smarty类库文件  */
    require BASE_PATH.SMARTY_PATH.'Smarty.class.php';
    //require 'D:\zhongyaowenjian\huanjing\wamp\www\1\system\smarty\Smarty.class.php';这个不能识别
    /*  实例化一个Smarty对象  */
    $smarty = new Smarty;
    /*  定义各个目录的路径 */
    $smarty->template_dir = BASE_PATH.'\1\system\templates/';
    $smarty->compile_dir = BASE_PATH.'\1\system\templates_c/';
    $smarty->config_dir = BASE_PATH.'\1\system\configs/';
    $smarty->cache_dir = BASE_PATH.'\1\system\cache/';
    /*  定义定界符  */
    $smarty->left_delimiter = '<{';
    $smarty->right_delimiter = '}>';?>
    上面这是我的配置文件
    下面是我的tpl文件
    <body>
    <{php}> echo "aaaaaaaaaaaaaaaaaaaaa";<{/php}><{$content}>
    <div class="badoo"><{$ccc}></div><hr />
    </body>
    </html>
    aaaaaaaaaaa不能显示啊,出现上面的错误