通过codeigniter中的重定向功能发布数据

编程入门 行业动态 更新时间:2024-10-08 20:40:05
本文介绍了通过codeigniter中的重定向功能发布数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在codeiginter中使用redirect()函数来发布数据数组或单个变量字符串数据有没有办法或一些技巧?

Is there ever a way or some tricks to post an array of data or a single variable string data using redirect() function in codeiginter?

推荐答案

当使用 redirect 你从一个控制器或另一个通过这个过程,所有的发布数据被销毁除非你存储在一个会话,这里是我如何it

when using redirect you go from one controller or another by this process all post data are destroyed unless you stored them on a session, here is how i do it

$data = array('firstname'=>'fname','lastname'=>'lastname'); // i store data to flashdata $this->session->set_flashdata('lolwut',$data); // after storing i redirect it to the controller redirect('controller/method')

您的重定向控制器上可以通过 $ this-> session-> flashdata('lolwut') 访问它我使用 flashdata 不 userdata , flashdata

so on your redirected controller you can access it via $this->session->flashdata('lolwut') note that i am using flashdata not userdata, flashdata destroys itself on the next process.

阅读更多flashdata这里 SESSION课程

read more flashdata here SESSION CLASS

更多推荐

通过codeigniter中的重定向功能发布数据

本文发布于:2023-10-10 18:28:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1479382.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   功能   数据   codeigniter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!