时间:2021-07-01 10:21:17 帮助过:17人阅读
Php代码
if(isset($_POST['sub'])){ $cfg = array('contact'=>$_POST['contact']); //把数据存入数组 file_put_contents('./data/contact.cache',serialize($cfg)); //把数组序列化之后,写到contact.cache里, $this->redirect('other/contact');//跳转 } else{ $fp = fopen('./data/contact.cache','r');//读 $cf = unserialize(fread($fp,filesize('./data/contact.cache')));//反序列化,并赋值 $this->assign('cfg',$cf);//送到前台模板 $this->display('other/contact'); }