<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></title> 
<link>http://www.bizeway.net/index.php</link> 
<description><![CDATA[网务通 - 网务公司发展之路]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></copyright>
<item>
<link>http://www.bizeway.net/read.php?</link>
<title><![CDATA[smarty的date_format中不能有中文的解决方案]]></title> 
<author>ArthurXF &lt;arthurxf@gmail.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Thu, 04 Feb 2010 04:51:05 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?</guid> 
<description>
<![CDATA[ 
	{$smarty.now&#124;date_format:"%Y年%m月%d日"} 这样写就成了"2010年%m月%d日"+一些乱码如果给汉字后加上空格就正常了，但是输出也有了空格。<br/><br/>为了解决这个问题，我去读了smarty的插件代码modifier.date_format.php：<br/>发现里面strftime这个PHP函数对于中文支持不好。<br/>所以我修改了modifier.date_format.php函数，一劳永逸啊。大家可以直接复制替换原有内容即可。<br/>而且我这个函数还是支持繁简中文的哦。呵呵<br/><div class="code">function smarty_modifier_date_format($string, $format = &#039;%b %e, %Y&#039;, $default_date = &#039;&#039;)<br/>{<br/> &nbsp; &nbsp;if (substr(PHP_OS,0,3) == &#039;WIN&#039;) {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$_win_from = array (&#039;%e&#039;, &nbsp; &#039;%T&#039;, &nbsp; &nbsp; &nbsp; &nbsp;&#039;%D&#039;);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$_win_to &nbsp; &nbsp;= array (&#039;%#d&#039;, &#039;%H:%M:%S&#039;, &#039;%m/%d/%y&#039;);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$format = str_replace($_win_from, $_win_to, $format);<br/> &nbsp; &nbsp; }<br/>&nbsp;&nbsp; $arrTemp = array(&#039;年&#039;,&#039;月&#039;,&#039;日&#039;,&#039;时&#039;,&#039;分&#039;,&#039;秒&#039;,&#039;時&#039;);<br/>&nbsp;&nbsp; foreach($arrTemp as $v){<br/>&nbsp;&nbsp;&nbsp;&nbsp; if(strpos($format,$v)){<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $strFormat = str_replace(&#039;%&#039;,&#039;&#039;,$format);<br/>&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp; }<br/> &nbsp; &nbsp; if($string != &#039;&#039;) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;if(!empty($strFormat)) return date($strFormat, smarty_make_timestamp($string));<br/>&nbsp;&nbsp;&nbsp;&nbsp;else return strftime($format, smarty_make_timestamp($string));<br/> &nbsp; &nbsp; } elseif (isset($default_date) &amp;&amp; $default_date != &#039;&#039;) {<br/>&nbsp;&nbsp;&nbsp;&nbsp; if(!empty($strFormat)) return date($strFormat, smarty_make_timestamp($default_date));<br/> &nbsp; &nbsp; &nbsp; &nbsp; else return strftime($format, smarty_make_timestamp($default_date));<br/> &nbsp; &nbsp; } else {<br/> &nbsp; &nbsp; &nbsp; &nbsp; return;<br/> &nbsp; &nbsp; }<br/><br/>}</div><br/>Tags - <a href="tag.php?tag=smarty" rel="tag">smarty</a> , <a href="tag.php?tag=date_format" rel="tag">date format</a> , <a href="tag.php?tag=%E4%B8%AD%E6%96%87" rel="tag">中文</a>
]]>
</description>
</item><item>
<link>http://www.bizeway.net/read.php?&amp;guid=0#topreply</link>
<title><![CDATA[[评论] smarty的date_format中不能有中文的解决方案]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?&amp;guid=0#topreply</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>