Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未定义变量:$sameday at somthing.php_Php_Error Handling - Fatal编程技术网

未定义变量:$sameday at somthing.php

未定义变量:$sameday at somthing.php,php,error-handling,Php,Error Handling,我将在something.php上为特色活动编写此代码 $day_start = date("j", mktime(0,0,0,$event_start_month, $event_start_day, $event_start_year)); $day_end = date("j", mktime(0,0,0, $event_end_month, $event_end_day, $event_end_year)); if (($day_start == $day_end

我将在something.php上为特色活动编写此代码

$day_start = date("j", mktime(0,0,0,$event_start_month, $event_start_day, $event_start_year));

$day_end = date("j", mktime(0,0,0, $event_end_month, $event_end_day, $event_end_year));



        if (($day_start == $day_end)) {
            $same_day = true;
        }
        <?php if ($same_day == false) { ?>
<span class="value value-date"> - <?php echo $day_end; ?></span>

您应该始终为
$same\u day
分配一些内容,以避免出现此警告。像这样:

if (($day_start == $day_end)) {
        $same_day = true;
    } else{
        $same_day =false; // <-- This is the new part.
    }
...
if ($same_day == false) {
if($day\u start==$day\u end)){
$same_day=正确;
}否则{

$same_day=false;//使用此选项可避免错误

$same_day = false;

if (($day_start == $day_end)) {
        $same_day = true;
    } 

......

 <?php if ($same_day == false) { ?>
            <?php echo $day_end; ?>
$same\u day=false;
如果($day\u start==$day\u end)){
$same_day=正确;
} 
......
if (($day_start == $day_end)) {
        $same_day = true;
    } else{
        $same_day =false; // <-- This is the new part.
    }
...
if ($same_day == false) {
$same_day = false;

if (($day_start == $day_end)) {
        $same_day = true;
    } 

......

 <?php if ($same_day == false) { ?>
            <?php echo $day_end; ?>