カテゴリー
PHP

今日の日付と日付リテラルの比較

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="GENERATOR" content="JustSystems Homepage Builder Version 18.0.14.0 for Windows">
<TITLE></TITLE>
</HEAD>
<body background="y8b.gif">

<?php
  require_once ("newpage8.php");
  print $APPTITLE;
  print "<HR>";
  print "<BR>";
  $today = date("m/d");
  if ($today == "05/23") {
    print "今日は $today です。<BR>";
    print "今日はあなたの誕生日です。<BR>";
  }
  else {
    print "今日は $today です。<BR>";
  }
  print "<BR>";
  print "<HR>";

  print "$APPFOOTER";
?>

<p><a href="newpage10.php">書き込みインデックスへ戻る</a></p>
</BODY>
</HTML>

 山爺のPHP試行錯誤的実験室へリンク張っておきます。上のブロックが肝です。newpage2.phpで今日の日付とリテラルの日付があっているか?判断してます。この辺がPHPの働きで、結果はブラウザへ送られます。HPBはPHPのエディタとしては向いてないかもしれませんが、もう少し使っていこうと思ってます。

inserted by FC2 system