我正在尝试在我的浏览器上显示 mysql 存储的 unix 时间戳值(并将它们保存到 CSV 文件中)。这些值存储为 int (11)。问题是,当我显示它们时,我看到了“d”、“P”、“j”、“M”和其他用于格式化日期的字符,而不是实际的时间戳。怎么了?
<?php
/* MySQL connection and database connection code */
mysql_query ("SELECT emailaddress, subscribedate FROM email_list_subscribers WHERE subscriberid = '$sid'");
$email_result= mysql_query ("SELECT emailaddress, subscribedate FROM email_list_subscribers WHERE subscriberid = '$sid'");
if (mysql_num_rows ($email_result) == 0) {
$email = '';
$subscribedate = '';
} else {
$email = mysql_fetch_assoc ($email_result);
$email = $email['emailaddress'];
$subscribedate = (string) ( $email['subscribedate']);
echo $sid . " : " . $subscribedate . "<br/>";
}
?>