2

初めて質問するので、間違えた場合は考慮に入れてください。これを見て、私がどこで間違っているのか説明してください。
カレンダー行の当月の第1週に前月の終了日を表示できます。ただし、現在の$print_dateでエコーされるアンカータグにクエリ文字列を含める必要があります。これらは、私がすでに成功せずに試みたさまざまな方法です。日付の形式は「YYYY-MD」です。

while ( $start_point > 0 ) 
{   
    // Returns what day of the week 'w' (numeric 0-6), using the date function.
    $day_of_week = date('w', mktime(0, 0, 0, $month, 1, $year));    
    // To get the last Sunday of the previous month use:
    $sun_prev_month = date('d', mktime(0, 0, 0, $month, (1 - $day_of_week), $year));
    // Fills the dates, starting on Sunday for the end of previous month
    $print_date = $sun_prev_month;      
    for ($i = 0; $i < $day_of_week; ++$i)
    {                       
        //echo '<td class="shade"><a href="/~seeleyja/CSCI-2910/calendar4.php?date=' . $year . '-' . ($month-1) . '-' . $print_date  . '">'. $print_date . '</a></td>';
                ?>
        <td><a href="/~seeleyja/CSCI-2910/calendar4.php?<?=htmlspecialchars($prev_month);?>"> $print_date </a></td>;
        <?php
        //echo '<td class="shade"><a href="/~seeleyja/CSCI-2910/calendar4.php?date=$prev_month">'. $print_date . '</a></td>';
        //echo '<td class="shade"><a href="/~seeleyja/CSCI-2910/calendar4.php?date=' . $year . '-' . ($month-1) . '-' . $print_date . '">'. $print_date . '</a></td>';
        --$start_point;
        $print_date++;                      
        $day_of_week_counter++;                             
    }
}
4

1 に答える 1

0

現在、未定義の変数 $prev_month を使用しており、URL の「日付」パラメーターを忘れています。$sun_prev_month または $print_date を使用するつもりでしたか?

于 2013-02-16T06:22:52.420 に答える