Rumah > Soal Jawab > teks badan
这是网上找的smarty设置的段代码。
一开始提示
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in F:phpstudyWWWsmartysconfig.php on line 2
我看到第二行没问题啊,于是自己从新敲了一遍,一抹一样的,就好了。
然后提示
Parse error: syntax error, unexpected T_VARIABLE in F:phpstudyWWWsmartysconfig.php on line 4
这就很费解了,$tpl = new Smarty(); 这句话有错吗?
谢谢。
<?php
include "/smarty/libs/Smarty.class.php";
define(@#__SITE_ROOT@#, @#f:/phpstudy/WWW/smartys/smarty@#); // 最后没有斜线
$tpl = new Smarty();
$tpl->template_dir = __SITE_ROOT . "/templates/";
$tpl->compile_dir = __SITE_ROOT . "/templates_c/";
$tpl->config_dir = __SITE_ROOT . "/configs/";
$tpl->cache_dir = __SITE_ROOT . "/cache/";
$tpl->left_delimiter = @#<{@#;
$tpl->right_delimiter = @#}>@#;
?>