问题:我自定义一个标签 如下:
<Bingo:voucher id="select_vouche" league_id="$league_id" name="vid" first="请选择"></Bingo:voucher>
上面标签里$league_id是PHP传来的值
PHP页面这么传的:$this->assign('league_id',$league['league_id']);
自定义标签里这么写的:
class TagLibBingo extends TagLib{
public function _voucher($attr) {
$league_id = $this->autoBuildVar($tag['league_id']);
$l = M('league')->field('city_code')->where("id={$league_id}")- >find();
(部分代码省略了。。。)
SQL里查不到结果
}
}
我是获取标签传来的值 然后用户where条件里。
但是查询的结果却是NULL.
如果、直接在 sql前面 return $league_id 却还可以看到这个值(值是12)
如果 M('league')->getLastSql(); 这样输出 SQL。结果where()里也有"id=12"
就是结果为空。。。。
求解。。