然后index控制器代码
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
$zlcount['ct']=111;
$this->assign('id',1);
$this->assign('zlcount',$zlcount);
$this->display();
}
}前端模板代码 <?php if($id == 1){?>
<tr>
<th colspan="8"><h3 class="toleft">【1111】</h3></th>
</tr>
<tr>
<th width="10%">3333</th><td><a href="{:U('index/index',array('ct'=>1))}">{$zlcount['ct']}</a></td>
<?php }elseif($id=2){ ?>
<th colspan="8"><h3 class="toleft">【222】</h3></th>
<?php }else{?>
<th colspan="8"><h3 class="toleft">【44444】</h3></th>
<?php }?>运行后发现{:U('index/index',array('ct'=>1))} 不解析 <tr>
<th colspan="8"><h3 class="toleft">【1111】</h3></th>
</tr>
<tr>
<th width="10%">3333</th><td><a href="{:U('zlinfo/index',array('ct'=>1))}">111</a></td>
最佳答案