外语中的 PHP date() - 例如09 年 3 月 25 日 [英] PHP date() in foreign languages - e.g. Mar 25 Aoû 09

查看:19
本文介绍了外语中的 PHP date() - 例如09 年 3 月 25 日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本需要向国际观众显示日期数据 - 例如

I have a script that needs to display date data to an international audience - e.g.

2009 年 8 月 25 日星期二提交"

"submitted Tue 25 Aug 09"

有没有更简单/更干净的方法可以将其转换为法语(等)等效的Mar 25 Aoû 09"?比:

Is there an easier/cleaner way to get this converted to the French(etc) equivalent "Mar 25 Aoû 09" than:

设置一个常量 LANG 和一个包含文件的 $LANGUAGES 数组 &:

Setting a constant LANG and a $LANGUAGES array of include files & :

if(LANG != 'EN')
{
include $LANGUAGES['LANG'];
}

&然后包含的文件映射天 &月&替换适当的语言环境?

& then the included file maps the days & months & replaces for the appropriate locale?

推荐答案

我认为如果不设置 LOCALE 就无法避免这样做:

I think you can't get away from doing so without setting LOCALE:

<?php
setlocale(LC_ALL, 'fr_FR');

echo strftime("%A %e %B %Y");
?> 

关于strftime的一些细节:http://us2.php.net/manual/en/function.strftime.php

Some details on strftime: http://us2.php.net/manual/en/function.strftime.php

这篇关于外语中的 PHP date() - 例如09 年 3 月 25 日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆