简体   繁体   English

尽管if条件,代码始终在杂货杂货中正常工作

[英]code always work in grocery crud although the if condition

I got stuck in a situation quite strange in my code. 我陷入了代码中很奇怪的情况。 It seems as the if condition does not work. 似乎if条件不起作用。 Here is my code: 这是我的代码:

if ($mode == "edit") {
    echo "edit mode!";
} 
else {
    $crud->set_rules('u_email','Email','is_unique[users.u_email]');
    echo "NOT edit mode!";
}

When I go to this url: grocery/edit/55 (my edit mode) i see the line edit mode! 当我转到以下网址时:杂货店/编辑/ 55(我的编辑模式),我看到了行编辑模式! . The strange thing here is the row below works: 奇怪的是,下面的行有效:

$crud->set_rules('u_email','Email','is_unique[users.u_email]');

That line works, But I still do not get the message NOT edit mode! 该行有效,但是我仍然没有收到消息NOT Edit Mode!

Why is this line always works? 为什么这条线总是有效? Why is_unique also works in the edit mode? 为什么is_unique也可以在编辑模式下工作?

Sorry about my bad english. 对不起,我的英语不好。 and thanks for all :-) 并感谢所有:-)

Do you have something that cover the text? 您有涵盖文字的内容吗? Hard to say why this is happening to you, but is the text "NOT edit mode!" 很难说为什么会这样,但文字是“ NOT edit mode!”。 in the source code? 在源代码中?

And if you are not in the edit mode, does the text EDIT MODE shows then? 并且,如果您未处于编辑模式,那么是否会显示文本EDIT MODE? I'm trying to exclude every possible error here. 我正在尝试排除所有可能的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM