php Tips

WBOY
WBOYOriginal
2016-06-23 14:37:12969browse

获得服务器时间:

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

 

日期格式化:

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

可参考: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>'; //刷新当前页面


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

 

Statement:
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
Previous article:PHP warningNext article:PHP IDE