Php Örnekleri

WMF

Gold Üye
Katılım
19 Haz 2018
Mesajlar
206
Tepki
2
Php Örnekleri
Tarihi yazdırmak

<html>

<head>
<title>Example #1 TDavid's Very First PHP Script ever!</title>
</head>
<? print(Date("1 F d, Y")); ?>

<body>
</body>
</html>
<html>

<head>
<title>Example #3 TDavid's Very First PHP Script ever!</title>
</head>
<? print(Date("m/j/y")); ?>

<body>
</body>
</html>
<html>

<head>
<title>PHP Script examples!</title>
</head>
<font face="Arial" color="#FF00FF"><strong><? print(Date("m/j/y")); ?>
</strong></font>

<body>
</body>
</html>
<html>

<head>
<title>Example #1 TDavid's Very First PHP Script ever!</title>
</head>
<? print(Date("l F d, Y")); ?>

<body>
</body>
</html>

Haftanın her günü farklı bir arkaplan rengi
<html>
<head>
<title>Background Colors change based on the day of the week</title>
</head>
<?
$today = date("l");
print("$today");
if($today == "Sunday")
{
$bgcolor = "#FEF0C5";
}
elseif($today == "Monday")
{
$bgcolor = "#FFFFFF";
}
elseif($today == "Tuesday")
{
$bgcolor = "#FBFFC4";
}
elseif($today == "Wednesday")
{
$bgcolor = "#FFE0DD";
}
elseif($today == "Thursday")
{
$bgcolor = "#E6EDFF";
}
elseif($today == "Friday")
{
$bgcolor = "#E9FFE6";
}
else
{
// Since it is not any of the days above it must be Saturday
$bgcolor = "#F0F4F1";
}
print("<body bgcolor=\"$bgcolor\">\n");
?>
<br>This just changes the color of the screen based on the day of the week
</body>
</html>
<html>
<head>
<title>Background Colors change based on the day of the week</title>
</head>
<?
$today = date("w");
$bgcolor = array(
"#FEF0C5", "#FFFFFF", "#FBFFC4", "#FFE0DD",
"#E6EDFF", "#E9FFE6", "#F0F4F1"
);
?>
<body bgcolor="<?print("$bgcolor[$today]");?>">
<br>This just changes the color of the screen based on the day of the week
</body>
</html>

Sayfanın en son değiştirilme tarihini gösteren php kodu

<html>
<head>
<title>Page last updated on month/date/year hour:min PHP Script</title>
</head>
<?
$last_modified = filemtime("example7.php3");
print("Last Modified ");
print(date("m/j/y h:i", $last_modified));
?>
</body>
</html>

<?
$check = "test";
$check .= $filename;
if ($test == $check)
{
print("<HTML><BODY>You have already voted. Thank you.</BODY></HTML>");
}
else
{
$rated = "test";
$rated .= $filename;
setcookie(test, $rated, time()+86400);
print("<HTML><BODY><br>You haven't voted before so I recorded your vote</BODY></HTML>");
}
?>
 
Son düzenleme:
Üst Alt