Heim >Backend-Entwicklung >PHP-Tutorial >php编写的闹钟程序_PHP教程
php
//闹钟程序
error_reporting(7);
ob_start();
if (!isset($i)) {
$msg= '现在时间是: '. date('h:i:s') ."
赶快睡觉吧";
$t=time();
refresh($msg,"funny.php?i=1&t1=$t",5);
}elseif ($i==1){
$msg= '现在时间是: '. date('h:i:s');
$t2=time();
$t3=$t2-$t1;
$msg.="
你睡了 $t3 秒, 该起床啦";
refresh($msg,'funny.php?i=2');
}elseif ($i==2) {
//
print
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
align="baseline" border="0" standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=media&sba=plugin&"
name="MediaPlayer" showcontrols="1" showpositioncontrols="0"
showaudiocontrols="1" showtracker="1" showdisplay="0"
showstatusbar="1"
autosize="0"
showgotobar="0" showcaptioning="0" autostart="1" autorewind="0"
animationatstart="0" transparentatstart="0" allowscan="1"
enablecontextmenu="1" clicktoplay="0"
defaultframe="datawindow" invokeurls="0">
EOT2;
}
function refresh($msg='',$url,$time='3'){
echo $msg."
";
echo "";
}
?>