Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 php/cakephp 新手,我的问题是 - 在使用 paginator::sort 对数据进行排序后,有没有办法保留表单数据(未保存在模型中)?显然,当您单击分页器排序链接时,您会转到不同的 URL,因此 _posted 数据消失了。给你一张我在代码中的图片 - 有一个单一的表格,里面有范围滑块和复选框。
当我需要在控制器中的不同操作之间共享发布的数据时,这对我有用。在控制器类中,我将这段代码添加到每个操作的开头:
// retrieve or save search data if(!empty($this->data)) $this->Session->write('SearchData', $this->data); else $this->data = $this->Session->read('SearchData');