满足条件时在 echo 语句中回显
echo within an echo statement when condition is met
是否可以在 echo 语句中回显?
我有一个 if 语句,如果满足时间条件,它会回显 HTML 元素。我想 echo echo $rows['SOMETHING'];在此回声声明中。所以...
if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from'])
{
echo'<div class="opening_times_times_orange"> ***** echo $rows['opening_monday_from'] . " " . "-" . " " $rows['opening_monday_to'] ***** </div>';
}
else echo '<div class="opening_times_times_red">***** echo $rows['opening_monday_from'] . " " . "-" . " " $rows['opening_monday_to'] ***** </div>';
?>
我想回显 ***** 之间的内容,但它不允许我使用当前脚本。
我该如何解决这个问题
if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from'])
{
echo'<div class="opening_times_times_orange"> HERE </div>';
}
else echo '<div class="opening_times_times_red"> HERE </div>';
此处 (1) echo $rows['opening_monday_from'];
和 echo $rows['opening_monday_to'];
这里 (2) echo $rows['opening_monday_from'];
和 echo $rows['opening_monday_to'];
试试这个:-
if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from'])
{
echo'<div class="opening_times_times_orange"> *****'. $rows['opening_monday_from']. " " . "-" . " ".$rows['opening_monday_to'].' ***** </div>';
}
else echo '<div class="opening_times_times_red">*****'.$rows['opening_monday_from'] . " " . "-" . " " .$rows['opening_monday_to'].' ***** </div>';
?>
是否可以在 echo 语句中回显?
我有一个 if 语句,如果满足时间条件,它会回显 HTML 元素。我想 echo echo $rows['SOMETHING'];在此回声声明中。所以...
if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from'])
{
echo'<div class="opening_times_times_orange"> ***** echo $rows['opening_monday_from'] . " " . "-" . " " $rows['opening_monday_to'] ***** </div>';
}
else echo '<div class="opening_times_times_red">***** echo $rows['opening_monday_from'] . " " . "-" . " " $rows['opening_monday_to'] ***** </div>';
?>
我想回显 ***** 之间的内容,但它不允许我使用当前脚本。
我该如何解决这个问题
if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from'])
{
echo'<div class="opening_times_times_orange"> HERE </div>';
}
else echo '<div class="opening_times_times_red"> HERE </div>';
此处 (1) echo $rows['opening_monday_from'];
和 echo $rows['opening_monday_to'];
这里 (2) echo $rows['opening_monday_from'];
和 echo $rows['opening_monday_to'];
试试这个:-
if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from'])
{
echo'<div class="opening_times_times_orange"> *****'. $rows['opening_monday_from']. " " . "-" . " ".$rows['opening_monday_to'].' ***** </div>';
}
else echo '<div class="opening_times_times_red">*****'.$rows['opening_monday_from'] . " " . "-" . " " .$rows['opening_monday_to'].' ***** </div>';
?>