代码点火器。我有问题显示即将到来的生日月(如7月)自定义

时间:2017-07-11 12:24:54

标签: codeigniter codeigniter-3

我是初学者在开发我有问题显示即将到来的生日月(如7月)指导我请解决此问题这里是代码。这是显示即将到来的生日的代码。

<h3 class="panel-title"><?php echo 'Upcomming Birthday' ?> - <?php echo date("F"); ?></h3>
    <ul class="leave_apps">
        <?php
        $m = date("m"); // Month value
        $y = date("Y"); // Year value
        $num = cal_days_in_month(CAL_gregorian , $m, $y);
        ?>
            <?php
            for ($i = 0; $i < count($employee); $i++) :

                $mem_bod_explode = explode("-", $employee[$i]->date_of_birth);

                $m_bday = mktime(0, 0, 0, $mem_bod_explode[1], $mem_bod_explode[2], $y);

                $start_date = date('Y-m', $m_bday) . '-01';
                $end_date = date('Y-m', $m_bday) . '-' . $num;

                if (date('Y-m-d') == date('Y-m-d', $m_bday)) {
                    $present_bday[] = $employee[$i];
                    $date = date('Y-m-d', $m_bday);
                    $pdate[] = date('d M Y', strtotime($date));

                } else if (date('Y-m-d', $m_bday) > $start_date && date('Y-m-d', $m_bday) <= $end_date) {
                    $future_bday[] = $employee[$i];
                    $date = date('Y-m-d', $m_bday);
                    $fdate[] = date('d M Y', strtotime($date));
                }

                ?>
        <?php endfor; ?>
        <?php if (!empty($present_bday)):foreach ($present_bday as $key => $v_bday): ?>
            <li>
                <a href="<?php echo base_url() ?>admin/employee/view_employee/<?php echo $v_bday->employee_id ?>">
                    <h5>
                    <div class="pull-left">
                            <img class="img-circle"  src="<?php echo base_url() . $v_bday->photo ?>">
                    </div>
                    <span><?php echo $v_bday->first_name . ' ' . $v_bday->last_name ?></span>
                    <small class="apps_category" style="color:red">(Today)</small>
                    <p class="leave_para"><?php echo $pdate[$key]; ?></p>
            </li>
        <?php endforeach; ?>
        <?php endif; ?>

0 个答案:

没有答案