2016-05-05 11 views

答えて

0

は今date_default_timezone_set('America/New_York');

は毎日定義設定

include('StoreHours.class.php'); 

..ファイルにStoreHours.class.phpフォームgithubのをダウンロードして、あなたは営業時間を表示したいあなたのファイルで、このファイルを含めます営業時間

// Must be in 24-hour format, separated by dash 
// If closed for the day, leave blank (ex. sunday) 
// If open multiple times in one day, enter time ranges separated by a comma 

$hours = array(
     'mon' => array('11:00-20:30'), 
     'tue' => array('11:00-13:00', '18:00-20:30'), 
     'wed' => array('11:00-20:30'), 
     'thu' => array('11:00-1:30'), // Open late 
     'fri' => array('11:00-20:30'), 
     'sat' => array('11:00-20:00'), 
     'sun' => array() // Closed all day 
); 

// Place HTML for output below. This is what will show in the browser. 
// Use {%hours%} shortcode to add dynamic times to your open or closed message. 
$template = array(
    'open'   => "Yes, we're open! Today's hours are {%hours%}.", 
    'closed'   => "Sorry, we're closed. Today's hours are {%hours%}.", 
    'closed_all_day' => "Sorry, we're closed today.", 
    'separator'  => " - ", 
    'join'   => " and ", 
    'format'   => "g:ia", // options listed here: http://php.net/manual/en/function.date.php 
    'hours'   => "{%open%}{%separator%}{%closed%}" 
); 

は、クラスの営業時間

$store_hours = new StoreHours($hours, $exceptions, $template); 

コール開/閉を出力する方法をレンダリングメッセージ

を開始示しなければ例外日(別売)

// Add exceptions (great for holidays etc.) 
// MUST be in a format month/day[/year] or [year-]month-day 
// Do not include the year if the exception repeats annually 
$exceptions = array(
    '2/24' => array('11:00-18:00'), 
    '10/18' => array('11:00-16:00', '18:00-20:30') 
); 

設定テンプレートのメッセージを追加します。

$store_hours->render(); 
それだ

ディスプレイ(週間)オープン時間の完全なリスト

echo '<table>'; 
    foreach ($store_hours->hours_this_week() as $days => $hours) { 
     echo '<tr>'; 
     echo '<td>' . $days . '</td>'; 
     echo '<td>' . $hours . '</td>'; 
     echo '</tr>'; 
    } 
echo '</table>'; 

.... :)

+0

おかげで、今それを設定しようとします。 – SparklingINsilencE

+0

@ SparklingINsilencEええ、どうか問題がある場合は教えてください... –