LoginSignup
2
2

More than 5 years have passed since last update.

PHP 時間を指定して表示

Posted at

phpで時間を指定してコンテンツを表示させる

サイトで期間限定で何かを表示させたいとき

$YmdHi = date("YmdHi");

//時間指定
$HTML['info'] = "";
if($YmdHi >= 2016xxxxxxxx and $YmdHi <= 2016xxxxxxxx) {
$HTML['info'] = <<< HTML
 <div id="info">【 お知らせ 】いつからいつまでhogehoge~</div>
HTML;
}
//header
$html['header'] = <<<HTML
{$HTML['info']}
<header>
.
.
.
.
.
HTML;

こんなかんじ

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2