Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在drupal中的弹出式api ajax中清除从drupal\u set\u消息生成的消息队列?_Drupal - Fatal编程技术网

如何在drupal中的弹出式api ajax中清除从drupal\u set\u消息生成的消息队列?

如何在drupal中的弹出式api ajax中清除从drupal\u set\u消息生成的消息队列?,drupal,Drupal,当Drups api ajax在drupal中打开时,如何清除从drupal set message生成的消息队列?drupal 5-8:运行将清除消息 在8.5.x中,您可以使用一项新服务。drupal\u get\u messages()函数将被弃用 使用Messenger服务清除所有邮件: $messages=\Drupal::messenger()->deleteAll()Drupal 7: 如果您想清除例如“状态”消息,则消息处于$\u会话中,您可以这样做: if (isset($_S

当Drups api ajax在drupal中打开时,如何清除从drupal set message生成的消息队列?

drupal 5-8:运行将清除消息

在8.5.x中,您可以使用一项新服务。
drupal\u get\u messages()
函数将被弃用

使用Messenger服务清除所有邮件:


$messages=\Drupal::messenger()->deleteAll()

Drupal 7:

如果您想清除例如“状态”消息,则消息处于$\u会话中,您可以这样做:

if (isset($_SESSION['messages']['status'])) {
  unset($_SESSION['messages']['status']);
}

你有5个问题,答案很好,但你还没有接受。请接受这些答案,人们会更倾向于帮助你,因为这个古老的d6解决方案也适用于d8。这在d7上不起作用。它在d7上仍然起作用。在尝试清除旧邮件后,请确保没有设置新邮件。查看api页面上的函数,它在所有版本中的工作方式都完全相同。这可以工作,但有一个问题是它在IE上不工作。非常奇怪。实际上,当`\Drupal::messenger()->deleteAll();`时,这对我是有效的在除IE之外的所有浏览器上工作。我必须添加
unset($\u会话['messages']