2 回答
TA贡献1841条经验 获得超3个赞
您的条件不正确,请结合使用:
if(isset($_SESSION["mycid"]) && $_SESSION["mycid"] == "14")
...
elseif(isset($_SESSION["mycid"]) && $_SESSION["mycid"] == "8")
效率更高的方法是if只在外部检查一次isset ,然后检查值:
if(isset($_SESSION["mycid"]))
{
if($_SESSION["mycid"] == "14")
{
...
}
elseif($_SESSION["mycid"] == "8")
{
...
}
else
{
...
}
}
else
{
//action for $_SESSION["mycid"] not set
}
TA贡献1806条经验 获得超5个赞
试试这个,
if (isset($_SESSION["mycid"])) {
switch ($_SESSION["mycid"]) {
case 7:
$storeTitle = "Jet Airways BrandSTORE";
$storeDLogo = "/images/jetAirwaysLogo.jpg";
$storecolor1 = "#000"; //applied in header background
$storecolor2 = "#FF9304"; //applied in mini header background
$storeGDlogo = "/images/globaJLinkerLogo.jpg";
$storeGMlogo = "/images/globaJLinkerLogo.jpg";
break;
case 8:
$storeTitle = "Jet Airways BrandSTORE";
$storeDLogo = "/images/jetAirwaysLogo.jpg";
$storeGDlogo = "/images/globaJLinkerLogo.jpg";
$storeGMlogo = "/images/globaJLinkerLogo.jpg";
break;
case 9:
$storeTitle = "Jet Airways BrandSTORE";
$storeDLogo = "/images/jetAirwaysLogo.jpg";
$storeGDlogo = "/images/globaJLinkerLogo.jpg";
$storeGMlogo = "/images/globaJLinkerLogo.jpg";
break;
case 10:
$storeTitle = "Jet Airways BrandSTORE";
$storeDLogo = "/images/jetAirwaysLogo.jpg";
$storeGDlogo = "/images/globaJLinkerLogo.jpg";
$storeGMlogo = "/images/globaJLinkerLogo.jpg";
break;
case 14:
$storeTitle = "Federation of Indian Exports Organization BrandSTORE";
$storeDLogo = "/images/hid/figo-14.jpg";
$storecolor1 = "#02ADF2"; //applied in header background
$storecolor2 = "#FF9304"; //applied in mini header background
$storeGDlogo = "/images/hid/gl-14.jpg";
$storeGMlogo = "/images/hid/gl-m-14.jpg";
break;
}
} else {
$storeDLogo = "/images/jetAirwaysLogo.jpg";
$storeGDlogo = "/images/globaJLinkerLogo.jpg";
$storeGMlogo = "/images/globaJLinkerLogo.jpg";
}
在这里,不要忘记通过default values,variables由于未设置condition
- 2 回答
- 0 关注
- 148 浏览
添加回答
举报