Redirect Drupal重定向

Redirect Drupal重定向,redirect,drupal-7,drupal-modules,drupal-hooks,Redirect,Drupal 7,Drupal Modules,Drupal Hooks,我正在从事一个项目,其中有一个自定义模块,其中包含drupal重定向代码,代码如下: if (empty($_GET['destination']) && isset($_COOKIE["abc"]) && $_COOKIE["abc"]<>'' && ($_POST['form_id'] != 'user_pass_reset')) { $_GET['destination'] = "xyz" ; } } if(空($

我正在从事一个项目,其中有一个自定义模块,其中包含drupal重定向代码,代码如下:

if (empty($_GET['destination'])
&& isset($_COOKIE["abc"])
&& $_COOKIE["abc"]<>''
&& ($_POST['form_id'] != 'user_pass_reset'))
  {
   $_GET['destination'] = "xyz" ;
  }
}
if(空($\u GET['destination']))
&&isset($_COOKIE[“abc”])
&&$\u COOKIE[“abc”]”
&&($\u POST['form\u id'!='user\u pass\u reset'))
{
$\u GET['destination']=“xyz”;
}
}

谁能解释一下第三行代码或者全部代码。谢谢

我已经在源代码中添加了评论<代码>与
相同=。看

if(空($\u GET['destination'])//检查$\u GET['destination']是否为空。
&&isset($\u COOKIE[“abc”])//检查$\u COOKIE[“abc”]是否不为空。
&&$\u COOKIE[“abc”]“”//检查$\u COOKIE[“abc”]是否不等于空字符串。
&&($\u POST['form\u id']!=“user\u pass\u reset”)//检查$\u POST['form\u id']是否不是“user\u pass\u reset”
{
$\u GET['destination']=“xyz”;//将$\u GET['destination']设置为“xyz”
}
}

应该在第二行修改一点

if (empty($_GET['destination']) //Check if $_GET['destination'] is empty.
&& isset($_COOKIE["abc"]) //Check if $_COOKIE["abc"] is EXISTS.
&& $_COOKIE["abc"]<>'' //Check if $_COOKIE["abc"] does not equal an empty string.
&& ($_POST['form_id'] != 'user_pass_reset')) //Check if $_POST['form_id'] is not   'user_pass_reset'
  {
   $_GET['destination'] = "xyz" ; //Set $_GET['destination'] to "xyz"
  }
}
if(空($\u GET['destination'])//检查$\u GET['destination']是否为空。
&&isset($\u COOKIE[“abc”])//检查$\u COOKIE[“abc”]是否存在。
&&$\u COOKIE[“abc”]“”//检查$\u COOKIE[“abc”]是否不等于空字符串。
&&($\u POST['form\u id']!=“user\u pass\u reset”)//检查$\u POST['form\u id']是否不是“user\u pass\u reset”
{
$\u GET['destination']=“xyz”;//将$\u GET['destination']设置为“xyz”
}
}

感谢您的快速回复和解释我还有一件事要问,和之间有什么区别!=?如果它们都做相同的事情,那么一定有地方应该使用它们,而不是数组中的其他。谢谢。@H_alt据我所知,没有任何实际的区别。由开发人员决定使用哪个。就我个人而言,我从未见过有人真正使用
//检查$\u COOKIE[“abc”]是否存在(它也可以为NULL)。这实际上是不准确的,
如果值为
NULL
,isset将返回
FALSE
<代码>isset-确定变量是否已设置且不为空
if (empty($_GET['destination']) //Check if $_GET['destination'] is empty.
&& isset($_COOKIE["abc"]) //Check if $_COOKIE["abc"] is EXISTS.
&& $_COOKIE["abc"]<>'' //Check if $_COOKIE["abc"] does not equal an empty string.
&& ($_POST['form_id'] != 'user_pass_reset')) //Check if $_POST['form_id'] is not   'user_pass_reset'
  {
   $_GET['destination'] = "xyz" ; //Set $_GET['destination'] to "xyz"
  }
}