I('intro') && $where = "$where and ".I('intro')." = 1" ;
这句话怎么理解
这句是用在 多条件 搜索框处的
I('intro') && $where = "$where and ".I('intro')." = 1" ;
首先I('intro') 不能为假,为假后面就不执行了。所以I('intro') 必须有值。
I('intro') 有值,那么执行后面的。$where = "$where and ".I('intro')." = 1" 这个是赋值语句
单独拿出来应该可以理解下面这句吧。
$where = "$where and ".I('intro')." = 1"
..... I('intro') 等同于 I('param.id')因为I函数有:
'DEFAULT_FILTER' => 'htmlspecialchars'
的过滤所以是htmlspecialchars($_GET['intro']),作为条件那么获取的变量intro值在过滤后不为空或者false
,是满足前面条件I('intro')后再对变量where赋值,$where = "$where and ".I('intro')." = 1" ;
等同于$where = "$where and I('intro') = 1",where被重新赋值
1 回答4.2k 阅读✓ 已解决
3 回答1.9k 阅读✓ 已解决
2 回答2.3k 阅读✓ 已解决
2 回答832 阅读✓ 已解决
1 回答1.4k 阅读✓ 已解决
2 回答2.3k 阅读
1 回答711 阅读✓ 已解决
逻辑异或,
I('intro')
为true
时,$where = "$where and ".I('intro')." =1";然后特意百度了一下
think PHP
3系列大 大I 函数也就是3左右这玩意儿为
null
?,不知道5会不会有什么不一样