我有3个变量,分别命名为$a
,$b
和$c
。这些变量保存来自数据库的动态值。php中变量的比较
我想比较这些变量,如果$a
,$b
,$c
保持空间的手段“”然后打印no message
如果变量$a
,$b
保持空间和$c
保持信息打印消息,如果$a
,$c
保持空间和$b
保持信息打印消息,如果$b
,$c
保持空间并且$a
保持消息打印消息。请帮帮我。由于
我的代码是
if(($_GET['ms1']== " ") && ($_GET['ms2'] == " ") && ($_GET['ms3']== " "))
{
print"<p style=color:red;text-align:center;font-family:Times New Roman,Georgia,Serif;>";
echo "No Message From Court.";
print"</p>";
print"<p style=color:green;text-align:center;font-family:Times New Roman,Georgia,Serif;>";
echo "Thank You";
print"</p>";
}
elseif(($_GET['ms1']==' ') && ($_GET['ms2']==' '))
{
print"<p style=color:red;font-family:Times New Roman,Georgia,Serif;text-align:center;>";
echo '3'.$_GET['ms3'];
print"</p>";
}
elseif(($_GET['ms1']== ' ') && ($_GET['ms3']==' '))
{
print"<p style=color:red;font-family:Times New Roman,Georgia,Serif;text-align:center;>";
echo '2'.$_GET['ms2'];
print"</p>";
}
elseif(($_GET['ms2']==' ') && ($_GET['ms3']==' '))
{
print"<p style=color:red;font-family:Times New Roman,Georgia,Serif;text-align:center;>";
echo '1'.$_GET['ms1'];
print"</p>";
}
问题是什么?顺便说一下,如果你想检查一个单引号,你至少应该使用'==='来引入使用单引号作为设置的问题。 – jeroen
问题是,变量包含空间,所以我根本没有比较,请帮助我先生 – user3181994
我想,如果所有变量包含空格然后打印没有消息,但在这三个,如果任何一个包含字符串消息,然后打印消息。 – user3181994