所以我已经对条件进行了一些测试,由于某种原因,我无法使这个函数到达最里面的if / else。
我希望有人能告诉我我做了什么?
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;
}
}
我希望内联评论能够很好地解释发生了什么,但如果没有,请向我询问更多信息。
答案 0 :(得分:0)
当我从原始类调用函数时,我使用了这段代码:
".read": "root.child('errands').child('permissions').child('userId').val() === auth.uid ",
问题是$ modpass实际上并不存在,所以我发送的是空白。
因此,纠正电话应该是这样的:
$post_name = verifyStridersIdentity($post_name,$modpass);