2012-01-22 24 views
3

我想知道是否有一種方法可以在strftime中使用語言環境來回顯本週的所有日子,而不管日期如何。用作標題或標題的排序,而不是使用常量並加載正確的標題。PHP回聲一週中的所有日子(strftime)

setlocale(LC_TIME, "de_DE"); 
echo strftime("%A", 1); //echos Monday 
echo strftime("%A", 2); //echos Tuesday 
echo strftime("%A", 3); //echos Wednesday 

,讓所有我需要做的就是改變語言環境不同的語言。

感謝

回答

1
setlocale(LC_TIME, "de_DE"); 
echo strftime("%A", strtotime("next Sunday")); 
echo strftime("%A", strtotime("next Monday")); 
echo strftime("%A", strtotime("next Tuesday")); 
echo strftime("%A", strtotime("next Wednesday")); 
echo strftime("%A", strtotime("next Thursday")); 
echo strftime("%A", strtotime("next Friday")); 
echo strftime("%A", strtotime("next Saturday")); 
+0

的感謝!工作(不能接受視圖分鐘仍然) – Stevanicus

+0

很高興聽到它。祝你好運。 – malonso

1

你可以或者創建一個簡單的for循環:

for ($i=0;$i<7;$i++) { 
     $weekday[] = strftime('%a ', mktime(0, 0, 0, 6, $i+2, 2013)); 
    } 
print_r($weekday);