php-使用嵌入式功能打印密钥
我需要帮助找出这些php打印(echo)语句以及它们的位置。我有一个嵌入式函数“strotime”,它将时间(列“StartTime”)转换为一种格式,但我无法将其正确打印出来。没有错误,只是没有更改或使用该函数 有人能帮我找出在这个foreach循环中正确放置这个的位置吗? (正如你们所看到的,我在开始时放置了一个if语句,也尝试了一个if语句,但没有运气)。谢谢你 你的帮助php-使用嵌入式功能打印密钥,php,printing,foreach,Php,Printing,Foreach,我需要帮助找出这些php打印(echo)语句以及它们的位置。我有一个嵌入式函数“strotime”,它将时间(列“StartTime”)转换为一种格式,但我无法将其正确打印出来。没有错误,只是没有更改或使用该函数 有人能帮我找出在这个foreach循环中正确放置这个的位置吗? (正如你们所看到的,我在开始时放置了一个if语句,也尝试了一个if语句,但没有运气)。谢谢你 你的帮助 $keys = array('Server', 'Target','Logdate','Set','StartTime
$keys = array('Server', 'Target','Logdate','Set','StartTime', 'Length','Size','Status');
echo '<table><tr>';
foreach ($keys as $column)
echo '<th>' . $column . '</th>';
echo '</tr>';
foreach ($data as $row){
echo '<tr>';
foreach ($keys as $column)
//if ($column == 'StartTime') {
// echo '<td>' . date("Y-m-d H:i:s",strtotime($row[$column])) . '</td>';
if (isset($row[$column])){
echo '<td>' . $row[$column] . '</td>';
} elseif ($column =='StartTime') {
echo '<td>' . date("Y-m-d H:i:s",strtotime($row[$column])) . '</td>';
} elseif ($column == 'Status') {
echo '<td> Check for Errors </td>';
} else {
echo '<td> </td>';
}
//}
}
echo '</table>';
$keys=array('Server','Target','Logdate','Set','StartTime','Length','Size','Status');
回声';
foreach($keys作为$column)
回显“”$栏";;
回声';
foreach($行数据){
回声';
foreach($keys作为$column)
//如果($column=='StartTime'){
//回显“”。日期(“Y-m-d H:i:s”,strotime($row[$column]));
如果(isset($row[$column])){
回显'.$row[$column].';
}elseif($column=='StartTime'){
回显“”。日期(“Y-m-d H:i:s”,strotime($row[$column]));
}elseif($column=='Status'){
回显“检查错误”;
}否则{
回声';
}
//}
}
回声';
更改
if (isset($row[$column])) {
到
顺便说一下:您缺少了
标记。在开头,如果foreach($row数据){
循环,请执行以下操作:
$row['StartTime'] = date("Y-m-d H:i:s",strtotime($row['StartTime']));
然后像任何其他列一样显示它。您的函数拼写错误(strotime
,而不是strotime
)。那么$data
包含什么?
$row['StartTime'] = date("Y-m-d H:i:s",strtotime($row['StartTime']));