dskzap8756 2015-11-23 14:14
浏览 40
已采纳

运行if / else语句并迷路

I'm having a brain dead moment and getting lost in my logic, please can someone help!

I'm looking to recreate 3 scenarios:

  1. If downloads AND resources exist.
  2. If only downloads exist.
  3. If only resources exist.

These are decided by the two statements:

Downloads = have_rows('downloads')

Resources = get_sub_field('resources')

How can I run through the 3 scenarios in an if/else loop?

  • 写回答

3条回答 默认 最新

  • doujiao2014 2015-11-23 14:18
    关注
    $downloads = have_rows('downloads');
    $resources = get_sub_field('resources');
    
    if($downloads && $resources) {
      // do something
    } elseif($downloads) {
      // do something else
    } elseif($resources) {
     // yet another something else
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 如何修改别人网站内的数字,各位接单的私我
  • ¥15 poi怎么在指定位置之后生成多个表格
  • ¥15 nginx在location设置了client_max_body_size依旧报错413
  • ¥15 C#添加WCF服务引用客户端调用方法没有反应
  • ¥15 stm32f103c8t6与esp8266
  • ¥15 使用Hadoop的MapReduce program
  • ¥15 Python发生IndexError错误如何解决?
  • ¥15 如何用matlab搭建激光器
  • ¥15 51单片机两路互补SPWM输出全桥逆变
  • ¥15 outlook左边用户名下拉为啥打不开了