<?php
header('content-Type:text/html;charset=UTF-8');
/*
*
*/
//1
date_default_timezone_set("America/New_York");
echo "美国纽约时间为:";
echo "<br>";
echo date('Y年m月d日 H:i:s');
echo "<br>";
date_default_timezone_set("PRC");
echo "当前时间为:";
echo "<br>";
echo date('Y年m月d日 H:i:s');
echo "<br>";
//3
$timer = strtotime("-1 day");
echo date('Y-m-d H:i:s', $timer);
echo "<br>";
function chang($i) {
$time1 = strtotime("+" . $i . " day");
$arr = array('天', '一', '二', '三', '四', '五', '六');
echo "星期" . $arr[date("w", $time1)];
echo "<br>";
}
chang(40);
//5
$time2 = strtotime("-11 day");
echo date('Y-m-d H:i:s', $time2);
echo "<br>";
//echo $time2;
echo "<br>";
$time3 = strtotime("+14 day");
echo date('Y-m-d H:i:s', $time3);
echo "<br>";
//echo $time3;
//6
echo "<br>";
//echo date('Y-m-d H:i:s',strtotime($star));
$star = mktime(12, 20, 10, date("12"), date("12"), date("2016"));
$over = mktime(8, 10, 30, date("02"), date("21"), date("2017"));
$i = 1;
while ($star < $over) {
$star = mktime(12, 20, 10, date("12"), date("12") + $i, date("2016"));
if ($star >= $over) {
$star = $over;
}
echo date('Y-m-d H:i:s', $star) . "<br>";
$i++;
}
//7
echo "<br>";
echo "<pre>";
print_r($_SERVER);
echo $_SERVER["REMOTE_ADDR"];
//8
function skip(){
header("location:http://www.myitem.com");
}
//9
function num($a){
return round(floor(ceil(abs($a))));
}
echo "<br>";
echo num(-3.14);
//10
function url(){
echo $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
}
header('content-Type:text/html;charset=UTF-8');
/*
*
*/
//1
date_default_timezone_set("America/New_York");
echo "美国纽约时间为:";
echo "<br>";
echo date('Y年m月d日 H:i:s');
echo "<br>";
date_default_timezone_set("PRC");
echo "当前时间为:";
echo "<br>";
echo date('Y年m月d日 H:i:s');
echo "<br>";
//3
$timer = strtotime("-1 day");
echo date('Y-m-d H:i:s', $timer);
echo "<br>";
function chang($i) {
$time1 = strtotime("+" . $i . " day");
$arr = array('天', '一', '二', '三', '四', '五', '六');
echo "星期" . $arr[date("w", $time1)];
echo "<br>";
}
chang(40);
//5
$time2 = strtotime("-11 day");
echo date('Y-m-d H:i:s', $time2);
echo "<br>";
//echo $time2;
echo "<br>";
$time3 = strtotime("+14 day");
echo date('Y-m-d H:i:s', $time3);
echo "<br>";
//echo $time3;
//6
echo "<br>";
//echo date('Y-m-d H:i:s',strtotime($star));
$star = mktime(12, 20, 10, date("12"), date("12"), date("2016"));
$over = mktime(8, 10, 30, date("02"), date("21"), date("2017"));
$i = 1;
while ($star < $over) {
$star = mktime(12, 20, 10, date("12"), date("12") + $i, date("2016"));
if ($star >= $over) {
$star = $over;
}
echo date('Y-m-d H:i:s', $star) . "<br>";
$i++;
}
//7
echo "<br>";
echo "<pre>";
print_r($_SERVER);
echo $_SERVER["REMOTE_ADDR"];
//8
function skip(){
header("location:http://www.myitem.com");
}
//9
function num($a){
return round(floor(ceil(abs($a))));
}
echo "<br>";
echo num(-3.14);
//10
function url(){
echo $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
}