format('Y-m-d H:i:s'); 返回到上一页: //"/> format('Y-m-d H:i:s'); 返回到上一页: //">
Home > Backend Development > PHP Tutorial > 4个php技巧小结

4个php技巧小结

WBOY
Release: 2016-06-20 13:00:48
Original
995 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

返回到上一页:

//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:
php
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