为什么在 codeigniter 中清除会话 flashdata 消息?

Why session flashdata message is being cleared in codeigniter?

首先,我想分享一下我在卸载页面时正在调用 api。

所以这里发生了什么。

When I submit the form below things are happening. 1. from submit data is being sent to server and data is being saved to database. 2. and once page is about to unload another api is being called (using sendBeacon method) and again it will do some operation.

以上动作正在按给定顺序分别执行。所以无论我在第一个动作结束时设置什么 flashdata,都不会来查看页面。

请指导我如何将会话闪存数据带到查看页面。

这就是我的想法

As second request is being made using sendBeacon method and it is being executed after edit or whatever function called on page submission so setting flashdata message is not working on redirection

让我知道如何在重定向页面上获取闪存数据消息。

在附加请求中使用 keep_flashdata 方法,我能够在重定向页面中使用 flashdata 消息。

下面是我在额外请求中的代码。

if($this->session->flashdata('success')) 
{
    $this->session->keep_flashdata('success');
} 
else if($this->session->flashdata('failure')) 
{
    $this->session->keep_flashdata('failure');
}