getContext()->getRequest(); $sql = "select * from lkt_software_jifen where id = 1"; $r = $db->select($sql); if($r){ $r = $r; }else{ $r = 1; } $request->setAttribute("r",$r); return View :: INPUT; } public function execute(){ $db = DBAction::getInstance(); $request = $this->getContext()->getRequest(); $jifennum = $request->getParameter('jifennum'); $switch = $request->getParameter('switch'); $rule = trim($request->getParameter('rule')); if($jifennum >= 0){ $sql = "select * from lkt_software_jifen where id = 1"; $r = $db->select($sql); if(!$r){ $sql = "insert into lkt_software_jifen(jifennum,switch,rule) values('$jifennum','$switch','$rule')"; $r = $db->insert($sql); // var_dump($sql,$r);exit; if($r > 0){ header("Content-type:text/html;charset=utf-8"); echo ""; return $this->getDefaultView(); } }else{ $sql = "update lkt_software_jifen " ."set jifennum = '$jifennum', switch = '$switch',rule='$rule' where id = 1"; $r = $db->update($sql); // var_dump($sql,$r);exit; if($r > 0){ header("Content-type:text/html;charset=utf-8"); echo ""; return $this->getDefaultView(); } } }elseif ($jifennum < 0) { // print_r(3);die; header("Content-type:text/html;charset=utf-8"); echo ""; return $this->getDefaultView(); }else{ // print_r(4);die; header("Content-type:text/html;charset=utf-8"); echo ""; return $this->getDefaultView(); } } public function getRequestMethods(){ return Request :: POST; } } ?>