您好,欢迎访问一九零五行业门户网

smarty - 请问这段php的错误在哪?我没找到错啊

这是网上找的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(); 这句话有错吗?
谢谢。
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 = @#right_delimiter = @#}>@#; ?>

回复内容: 这是网上找的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(); 这句话有错吗?
谢谢。
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 = @#right_delimiter = @#}>@#; ?>

确保引用路径正确,或者把smarty括号去掉试试看。例如
$tpl = new smarty;
第一行引入的路径不对?
像是路径问题?把路径最开始的斜杠去掉试试看。。
第一个报错像是bom问题吧,别用记事本保存。
@#是什么,难道是我的显示有问题?
另外很多人说是引入路径的问题,显然这是不对的,错误出现在代码解释期,还没到执行呢。
@#是个什么鬼?看错误信息,你这不是 new smarty; 出错,也不是include出错。
你是不是网上复制代码 我估计是中文字符导致解析错误 肉眼无法看出
其它类似信息

推荐信息