php strtotime 函数UNIX时间戳

yipeiwu_com5年前PHP代码库
如果 time 的格式是绝对时间则 now 参数不起作用。如果 time 的格式是相对时间则其所相对的时间由 now 提供,或者如果未提供 now 参数时用当前时间。失败时返回 -1。

<?php
echo strtotime ("now"), "\n";
echo strtotime ("10 September 2000"), "\n";
echo strtotime ("+1 day"), "\n";
echo strtotime ("+1 week"), "\n";
echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime ("next Thursday"), "\n";
echo strtotime ("last Monday"), "\n";
?><?php
$str = 'Not Good';
if (($timestamp = strtotime($str)) === -1) {
echo "The string ($str) is bogus";
} else {
echo "$str == ". date('l dS of F Y h:i:s A',$timestamp);
}
?>
这个效果和用mktime()是一样的.

相关文章

php常用Output和ptions/Info函数集介绍

flush函数:刷新输出缓冲ob_clean函数:清空输出缓冲ob_end_clean函数:清空缓冲区并且关闭正在进行的输出缓冲ob_end_flush函数:发送缓冲区数据并且关闭缓冲区...

php过滤所有恶意字符(批量过滤post,get敏感数据)

函数代码:复制代码 代码如下://php 批量过滤post,get敏感数据 if (get_magic_quotes_gpc()) { $_GET = stripslashes_arra...

php文件夹的创建与删除方法

本文实例讲述了php文件夹的创建与删除方法。分享给大家供大家参考。具体如下: 1、创建文件夹 复制代码 代码如下:<?php //文件夹的创建 $file_path = "...

PHP实现的策略模式示例

本文实例讲述了PHP实现的策略模式。分享给大家供大家参考,具体如下: 个人觉得设计模式只有在实际应用中才能够慢慢的去熟悉,到最后做到心中有模式,事事有模式,哈哈 例如:一个电商首页,...

PHP常见过waf webshell以及最简单的检测方法

PHP常见过waf webshell以及最简单的检测方法

前言 之前在Webshell查杀的新思路中留了一个坑 ️,当时没有找到具体找到全部变量的方法,后来通过学习找到了个打印全部量的方法,并再次学习了下PHP webshell绕...