在smarty中使用print_r函数 打印异常
实际上在smarty中不需要使用print_r函数,但smarty中支持php的内置函数 按理说也是可以正常使用的,于是...测试了下
<?php
require './libs/Smarty.class.php';
$smarty = new Smarty();
$smarty->setTemplateDir('tpl');
$smarty->setCompileDir('template_c');
$smarty->setCacheDir('cache');
$smarty->caching = false;
$smarty->cache_lifetime = 120;
$smarty->display('test.tpl');
?>test.tpl中的代码:
{"a"|print_r}打印结果是 a1
为何?不应该是a吗?