2016-09-20 48 views
-3

我使用笨,并希望只有当以下条件属实OR“||” opreator未if语句工作在PHP

<?php 
if(($this->uri->segment(1)!='reports') || ($this->uri->segment(2)!='manageflyers' && $this->uri->segment(3)!='save')){?> 
    //some js code 
<?php }?> 

到SHWO的JS代码,但我不能正常工作,请帮助我在哪里做这个错误。

+0

你得到有什么错误? – jitendrapurohit

+1

你能描述你想展示js代码的条件吗? –

+0

我想显示js代码时不报告,不manageflyer,而不是保存在我的网址显示 – smehsoud

回答

2

与OR ||一对夫妇的!=将总是等于真实的,因为该字符串变量将只相当于一两件事,不是其他

所以你的代码会像这样

<?php 
if(($this->uri->segment(1)=='reports') || ($this->uri->segment(2)=='manageflyers' && $this->uri->segment(3)=='save')){ 
    //do nothing 
}else{ 
    //some js code 
}