本文整理匯總了PHP中calendar::month方法的典型用法代碼示例。如果您正苦於以下問題:PHP calendar::month方法的具體用法?PHP calendar::month怎麽用?PHP calendar::month使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類calendar
的用法示例。
在下文中一共展示了calendar::month方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: calendar
<?php
require '../calendar.php';
date_default_timezone_set('UTC');
setlocale(LC_ALL, 'en_US');
// get the year and number of week from the query string and sanitize it
$year = filter_input(INPUT_GET, 'year', FILTER_VALIDATE_INT);
$month = filter_input(INPUT_GET, 'month', FILTER_VALIDATE_INT);
// initialize the calendar object
$calendar = new calendar();
// get the current month object by year and number of month
$currentMonth = $calendar->month($year, $month);
// get the previous and next month for pagination
$prevMonth = $currentMonth->prev();
$nextMonth = $currentMonth->next();
// generate the URLs for pagination
$prevMonthURL = sprintf('?year=%s&month=%s', $prevMonth->year()->int(), $prevMonth->int());
$nextMonthURL = sprintf('?year=%s&month=%s', $nextMonth->year()->int(), $nextMonth->int());
// set the active tab for the header
$activeTab = 'month';
require '../assets/snippets/header.php';
?>
<section class="month">
<h1>
<a class="arrow" href="<?php
echo $prevMonthURL;
?>
">←</a>
<?php