在if()
声明中是否有任何方法可以有多个子句?if语句的单独条款?
例如:
if(($username=='textUser' && $role=='admin') || ($admin=='yes'))
{
// If the username AND role are set to admin OR if the admin is set to 'yes'
}
else
{
// Neither clauses of the if statement are true
}
也许这实际上是正确的代码,我没有尝试过它 - 但如果没有,任何人都可以告诉我怎么样? :)
@tarnfeld - 未来,在提问之前可能值得尝试一下你的代码。 – 2010-02-01 16:34:45