有人知道下面的语句应该是什么样子吗?我尝试过多种结构,如while循环和switch语句,但我无法弄清楚。我知道下面的代码是完全错误的,只是想显示我想要的
if($numrows > 0)
{
if($this->currentURL() == 'http://localhost/webshop/public/index.php?page=login.php')
{
$this->redirect();
}
}
else
{
echo "Wrong Username or Password!";
}
if($numrows > 0)
{
if($this->currentURL() == 'http://localhost/webshop/public/index.php?page=register.php')
{
echo "Already in use!";
}
}
else
{
$this->insertRows();
}
我猜你想要这样的逻辑,
if($numrows > 0)
{
if($this->currentURL() == 'http://localhost/webshop/public/index.php?page=login.php')
$this->redirect();
else if($this->currentURL() == 'http://localhost/webshop/public/index.php?page=register.php')
echo "Already in use!";
else
echo "Wrong Username or Password!";
}
else
$this->insertRows();