php Tips

WBOY
Release: 2016-06-23 14:37:12
Original
966 people have browsed it

获得服务器时间:

date_default_timezone_set('PRC'); //其中PRC为"中华人民共和国"$serverDate = date("Y-m-d G:i:s");
Copy after login

日期格式化:

$date = new DateTime('2000-01-01');echo $date->format('Y-m-d H:i:s');
Copy after login

可参考:http://www.w3school.com.cn/php/php_ref_date.asp
http://php.net/manual/zh/function.date.php

返回到上一页:

//php方式header("Location: " . $_SERVER['HTTP_REFERER']);//js方式echo "<script>history.back();</script>";echo '<script>window.location="...url";</script>'; //跳转到指定页面echo '<script>self.location.reload();</script>'; //刷新当前页面
Copy after login


@符号:不显示错误信息(加在函数前)

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template