Ben bir tarih ve zaman yakalamak için bu kodu vardır:
date('F j, Y, g:i a T')
ve tasarruf gibidir
$datetime:
ve ben bir şablon eklemek için bu kodu vardır:
function template_contents($file, $model) {
if (!is_file($file)) {
throw new Exception("Template not found");
}
ob_start();
include $file;
$contents2 = ob_get_contents();
ob_end_clean();
return $contents;
}
if($datetime == "No Date Yet"){
echo template_contents("post.php", $model);
} elseif($datetime == "June 2, 2010, 2:55 pm MDT"){
echo template_contents("notpost.php", $model);
}else {
echo template_contents("post.php", $model);
}
Ve ben $ datetime az 2 gün ise notpost.php şablonunu göstermek için elseif deyimi düzenlemek için umut olarak. Yani, notpost.php iki gün boyunca gösterir ve post.php iki gün sonra gösterir.