所以我做了一些測試條件,出於某種原因,我不能讓這個函數達到最內層的if/else。PHP函數沒有達到最內層的嵌套if塊
我希望有人能告訴我我做了什麼?
function verifyStridersIdentity($post_name, $modpass) {
//is the post name strider?
//this part works
if (strtolower($post_name) == 'strider') {
//is the mod pass set?
//this part ALSO works
if (!empty($modpass)) {
//modpass has some kind of value
$staff_name = md5_decrypt($modpass, KU_RANDOMSEED);//is it actually Strider though?
//this seems to be the block I am having trouble getting into?
//I can not get a value of either of these next two return statements.
if ($staff_name == $post_name) {
return 'This Works, It\'s me!'; //this is Strider
}
else {
return 'This is '.$staff_name.' attempting to be Strider. This has been logged.';
}
}
else {
return 'Anonymous Test';
}
}
else {
return $post_name;
}
}
我希望內聯評論能夠解釋發生了什麼,但如果不是,請詢問我的更多信息。
好了,我要感謝的人誰讀這一點,但事實證明,我其實調用的函數不正確。我會發布解決方案。 –
所以它工作正常。 '$ modpass'是空的,所以它跳過了'if'塊並轉到'else'塊。 – Barmar