<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>时间前 &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/%E6%97%B6%E9%97%B4%E5%89%8D/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Mon, 01 Oct 2012 11:06:02 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.1</generator>
	<item>
		<title>php获取前秒分时天</title>
		<link>https://www.mudbest.com/php%e8%8e%b7%e5%8f%96%e5%89%8d%e7%a7%92%e5%88%86%e6%97%b6%e5%a4%a9/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 01 Apr 2011 03:16:21 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[时间前]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=528</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
/**
 * 获取 几秒前，几分钟前，几小时前，几天前
 * by hkshadow
 * 2011-04-01
 * Enter description here ...
 * @param $val this mktime() or date()
 */
function ToTime($val){
	$nows = date(&quot;Y-m-d H:i:s&quot;,mktime());
	//$nows = date(&quot;Y-m-d H:i:s&quot;,mktime()+8*60*60);
	$nows = strtotime($nows);
	if (strlen($val) &gt;= 11){ 
		$show_time = strtotime($val);
		}else{
			$show_time = $val;
		}
	$overtime = $nows - $show_time;
	if ($overtime &lt; 0 ){
		return $overtime.&quot;秒前&quot;;
	}else if ($overtime &lt; 60){
		return $overtime.&quot;秒前&quot;;
	}else if ($overtime &lt; 3600){
		return ceil($overtime/60).&quot;分钟前&quot;;
	}else if ($overtime &lt; 86400){
		return ceil($overtime/3600).&quot;小时前&quot;;
	}else if ($overtime &lt; 259200) {  //三天前
		return ceil($overtime/86400).&quot;天前&quot;;
	}else{
		return $overtime;
	}
}
</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
