有人可以解释为什么
之间存在差异function foo($a){$blah = $a}.......
foo($CONSTANT);
和
function foo() { $blah = $CONSTANT}.......
foo();
顶级方法适用于我,另一种方法不适用。 具体来说,下面找到if语句false:
$this->setsession($user->id,$user->email, ($user->activated == 1) ? STATUS_ACTIVATED : STATUS_NOT_ACTIVATED);
if ($user->activated == 0) { // fail - not activated
$this->error = array('not_activated' => '');
虽然这个确实如此:
$this->setsession();
if ($user->activated == 0) { // fail - not activated
$this->error = array('not_activated' => '');
答案 0 :(得分:0)
对于一个写得不好的问题感到抱歉。 区别在于变量范围,我需要传递变量,因为我调用的那些变量无法被引用。