-2

次のコードは、2 番目の elseif ステートメントで構文エラーを返しています。

if(($Rec["gradyear"] = $mydate[year] && $mydate[month] IN ("January","February","March","April","June","July")) || ($Rec["gradyear"] = $mydate[year] -1 && $mydate[month] IN ("August","September","October","November","December"))) {
    $bgcolor="#00FF00";
} elseif(($Rec["gradyear"] = $mydate[year] -1 && $mydate[month] IN ("January","February","March","April","June","July")) || ($Rec["gradyear"] = $mydate[year] -2 && $mydate[month] IN ("August","September","October","November","December")))  {
    $bgcolor="#FFFF00";
} elseif(($Rec["gradyear"] = $mydate[year] -2 && $mydate[month] IN ("January","February","March","April","June","July")) || ($Rec["gradyear"] = $mydate[year] -3 && $mydate[month] IN ("August","September","October","November","December"))) { 
    $bgcolor="#FF0000"; $fontcolor="#FFFFFF";
}

私の人生では、私はそれを見つけることができません。どんな助けでも大歓迎です。

また、十分な情報が含まれていない場合は、事前にお詫び申し上げます。ここに投稿するのは初めてなので、お手柔らかにお願いします。:)

4

2 に答える 2

1

無効です

PHP でin_arrayを使用します。

例えば:

in_array($mydate[month] ,
array("January","February","March","April","June","July")
);
于 2013-08-13T21:09:22.877 に答える