老师,是不是截取的字符串为27个而不是29个,貌似总是少两个???有这种情况吗???
王利亚1990
2014-08-21
3 回答
{testblock change='true' length=3}
{$str11}
{/testblock}
///////
<?php
require('../smarty/Smarty.class.php');
$smarty=new Smarty();
//五配置两方法
$smarty->left_delimiter="{";
$smarty->right_delimiter="}";
$smarty->template_dir="tpl";
$smarty->cache_dir="cache";
$smarty->compile_dir="template_c";
$smarty->assign('str11','01234567890123456789');
$smarty->display('block.tpl');
/////////////////////
<?php
function smarty_block_testblock($params,$content)
{
$change=$params['change'];
$length=$params['length'];
if($change=='true')
{
$content=str_replace(0,'A',$content);
}
$content=substr($content,0,$length);
return $content;
}
////////////////
举报
0/150
提交
取消