php strotime on while循环,范围按月

php strotime on while循环,范围按月,php,Php,所以,我只想打印表的3倍,但按照我的方式,在这段时间内返回6倍。怎么做?有什么想法@Amal Murali?我现在读这些代码已经太晚了,但作为一个提示:你应该使用一个模板系统,比如Snarty,将程序逻辑与html代码分离。谢谢你的提示!晚安 $iniDB = date('d/m/Y', strtotime('2014-03-01 00:00:00') ); $fimDB = date('d/m/Y', strtotime('2014-03-31 00:00:00') ); $inicio =

所以,我只想打印表的3倍,但按照我的方式,在这段时间内返回6倍。怎么做?

有什么想法@Amal Murali?我现在读这些代码已经太晚了,但作为一个提示:你应该使用一个模板系统,比如Snarty,将程序逻辑与html代码分离。谢谢你的提示!晚安
$iniDB = date('d/m/Y', strtotime('2014-03-01 00:00:00') );
$fimDB = date('d/m/Y', strtotime('2014-03-31 00:00:00') );
$inicio  = implode("-", array_reverse(explode("/", $iniDB)));
$fim     = implode("-", array_reverse(explode("/", $fimDB)));
$month  = strtotime($inicio);
$end    = strtotime($fim);
$html='';

**while($month < $end ) {** 
    $y++;
    $html="";

        if($x == 1){
            $month = strtotime($inicio);
            $li = "<tr>".$monthNames[date('n', $month)-1].' '.date('Y', $month)."</tr>";
            $totalDaysMonth = date('t',$month);

      }elseif($x == 0){
            $month = strtotime("first day of next month",$month);
            $li = "<tr>".$monthNames[date('n', $month)-1].' '.date('Y', $month)."</tr>"; 
            $totalDaysMonth = date('t',$month);
        }

        for($d = 0; $d < count($locaisArr); $d++){ 
            $html ="";
                $html .= '<table border="1"><tr><strong> '. $locaisArr[$d]['nome_local'].'</strong></tr><tr>';

                    $a  ="";
                    if($a != 0){
                        $html.= "<tr><td width='40' height='20'></td>";
                    }elseif($a == 0){
                        $html.= "<tr><td width='40' height='20'>QTDE</td>";
                    }

                    $tempDate = 0;
                    for ($i=1; $i<= intval(date('t', $month)); $i++){
                        if($i <= 9){
                            $i = '0'.$i;
                        }
                        $tempDate = date('Y', $month).'-'.date('m', $month).'-'.$i;
                        if(date('Y-m-d', strtotime( $tempDate)) < $inicio){$bg= "bgcolor='#eeeeee'"; }else{$bg="";}
                        if(date('Y-m-d', strtotime( $tempDate)) > $fim){ $bg2= "bgcolor='#eeeeee'";}else{$bg2="";}

                        if( (date('w', strtotime( $tempDate)) == 0) || (date('w', strtotime( $tempDate)) == 6) ) {$fds = 'bgcolor="#707070"';$bgInput = "bgcolor='#B6B6B6'";}else{$fds = '';$bgInput="";}
                        if($a == 0){
                            $html.= "<td width='35' height='20' ".$fds.">".$weekDays[date('w', strtotime( $tempDate))]."</td>"; 

                        }else{
                            $html.= "<td width='35' height='20'></td>"; 
                        }
                    }
                    $html.= "</tr><tr><td width='40' height='20'>&nbsp;</td>";
                    $tempDate = 0;
                    for ($i=1; $i<= intval(date('t', $month)); $i++){
                        if($i <= 9){
                            $i = '0'.$i;
                        }
                        $tempDate = date('Y', $month).'-'.date('m', $month).'-'.$i;
                        if(date('Y-m-d', strtotime( $tempDate)) < $inicio){$bg= "bgcolor='#eeeeee'"; }else{$bg="";}
                        if(date('Y-m-d', strtotime( $tempDate)) > $fim){ $bg2= "bgcolor='#eeeeee'";}else{$bg2="";}

                        if( (date('w', strtotime( $tempDate)) == 0) || (date('w', strtotime( $tempDate)) == 6) ) {$fds = 'bgcolor="#707070"';$bgInput = "bgcolor='#B6B6B6'";}else{$fds = '';$bgInput="";}
                        if($a == 0){
                            $html.= "<td width='35' height='20' ".$fds.">".$i."</td>";  

                        }else{
                            $html.= "<td width='35' height='20'></td>"; 
                        }
                    }

            $html.= "</tr>";

            $x = 0;
            $html.= "</tbody></table>";
            echo $html."<br/>";
            }

        }
Array ( [0] => Array ( [nome_local] => Terminal Rodoviário Angra dos Reis [id_local] => 18 [valor_tabela] => ) [1] => Array ( [nome_local] => Terminal Rodoviário Antonio Bezerra [id_local] => 20 [valor_tabela] => ) [2] => Array ( [nome_local] => Terminal Rodoviário Barra Funda [id_local] => 26 [valor_tabela] => ) )