它给出了错误,因为 mktime 函数只需要所有数字值,而这个函数只给出 date 。如果你尝试喜欢
$h = 18;
$i = 11;
$s = 00;
$m = 07;
$d =23;
$y = 2009;
echo date("h-i-s-M-d-Y",mktime($h,$i,$s,$m,$d,$y));
那么它将起作用。
所以你的完整代码将是
date_default_timezone_set('UTC');
$d = str_replace('/', ',', '07/23/2009');
$t = str_replace(':', ',', '18:11');
$date = $t.',0,'.$d;
$fulldate = explode(',',$date);
echo '<br>';
$h = $fulldate[0];
$i = $fulldate[1];
$s = $fulldate[2];
$m = $fulldate[3];
$d =$fulldate[4];
$y = $fulldate[5];
echo date("h-i-s-M-d-Y",mktime($h,$i,$s,$m,$d,$y)) . "<br>";
//如果你想要时间戳然后使用
echo strtotime("07/23/2009 18:11");
谢谢