【发布时间】:2017-10-02 13:11:44
【问题描述】:
我是 CodeIgniter 的新手。我的视图文件中有 if/if else 语句和 || 之后的代码不工作
这是我认为的代码
<?php if (($destination["site"]!="block_view/profile/profile")||($destination["site"]!="block_view/profile/slips")){
?>
<section id="profilephp-header" style="background-image: url(<?php echo base_url('assets/img/parallax/header-profile.jpg'); ?>);" class="parallax">
<div class="overlay">
<div class="container">
<div class="row">
<div class="sec-title text-center wow animated fadeInDown">
<img src="<?php echo base_url('assets/img/parallax/profile-text.png'); ?>" alt="">
</div>
</div>
</div>
</div>
</section>
<?php
}else if(($destination["site"]=="block_view/profile/profile")||($destination["site"]=="block_view/profile/slips")){?>
<section id="profilephp-header2" style="background-image: url(<?php echo base_url('assets/img/parallax/header-profile.jpg'); ?>);" class="parallax">
<div class="overlay">
</div>
</section>
<?php
}?>
似乎 if 语句只接受一个条件。我的视图文件中的所有条件都是这样的。
【问题讨论】:
-
但是两个 if 语句是一样的吗?我错过了什么吗?
-
不,它们不是,但看到声明,
$destination["site"]只能有一个值,要么不是"block_view/profile/profile"要么 不是"block_view/profile/slips"所以这个 @987654325 @语句总是true
标签: php codeigniter if-statement