0

このコードを使用して時間を表示します

$in_Body .= 'Time: ' .  gmdate('F j, Y, h:i:s A') . "\n\n";

しかし、エジプトのように国別の表示時間が欲しい

完全なコード

<?php
$webmaster_mail = 'sales@elfnoon.com';
$redirect_page = 'elfnoon.com/';
$message_subject = 'رسالة من زائر لموقعك';
$in_Body ='';
foreach($_POST as $in_k=>$in_v) {
  $in_Body .="$in_k = $in_v\n\n";
}
$in_Body .= 'IP: ' . $_SERVER['REMOTE_ADDR'] . "\n\n";
$in_Body .= 'Browser: ' . $_SERVER['HTTP_USER_AGENT'] . "\n\n";
$in_Body .= 'Time: ' .  gmdate('F j, Y, h:i:s A') . "\n\n";
mail(trim($webmaster_mail), "$message_subject ", "$in_Body","From: " . trim($webmaster_mail));
header("Location: $redirect_page");
?>

何か案が???

4

2 に答える 2

2

エジプト時間を使用したい場合は、date_default_timezone_setサポートされているタイムゾーンのリストをご覧ください。

gmdateは、GMT タイムゾーンに基づく時刻を返します。エジプトはUTC+2です。

于 2012-09-06T17:42:25.853 に答える
0

コードでタイムゾーンを設定します:-

 ini_set('date.timezon','Europe/Brussels');  

またはこれを試してください

<?php

ini_set('date.timezon','Europe/Brussels');
$webmaster_mail = 'sales@elfnoon.com';
$redirect_page = 'elfnoon.com/';
$message_subject = '????? ?? ???? ??????';
$in_Body ='';
foreach($_POST as $in_k=>$in_v) {
  $in_Body .="$in_k = $in_v\n\n";
}
$in_Body .= 'IP: ' . $_SERVER['REMOTE_ADDR'] . "\n\n";
$in_Body .= 'Browser: ' . $_SERVER['HTTP_USER_AGENT'] . "\n\n";
$in_Body .= 'Time: ' .  gmdate('F j, Y, h:i:s A') . "\n\n";
mail(trim($webmaster_mail), "$message_subject ", "$in_Body","From: " . trim($webmaster_mail));
header("Location: $redirect_page");
?>
于 2012-09-06T17:43:56.817 に答える