當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Filter::form方法代碼示例

本文整理匯總了PHP中Filter::form方法的典型用法代碼示例。如果您正苦於以下問題:PHP Filter::form方法的具體用法?PHP Filter::form怎麽用?PHP Filter::form使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Filter的用法示例。


在下文中一共展示了Filter::form方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: help_save

 function help_save()
 {
     $rules = array('title:required:標題不能為空!', 'content:required:內容不能為空!');
     $info = Validator::check($rules);
     if ($info == true) {
         Filter::form(array('sql' => 'title', 'text' => 'content'));
         if (Req::args('id') == null) {
             Req::args('publish_time', date('Y-m-d H:i:s'));
         }
         $id = Req::args('id');
         $model = new Model("help");
         if ($id) {
             $model->where("id={$id}")->update();
             Log::op($this->manager['id'], "修改幫助", "管理員[" . $this->manager['name'] . "]:修改了幫助 " . Req::args('title'));
         } else {
             $model->insert();
             Log::op($this->manager['id'], "添加幫助", "管理員[" . $this->manager['name'] . "]:添加了幫助 " . Req::args('title'));
         }
     } else {
         if (is_array($info)) {
             $data = Req::args() + array('validator' => $info);
             $this->redirect('help_edit', false, $data);
             exit;
         }
     }
     $this->redirect("help_list");
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:27,代碼來源:content.php

示例2: ask_validator

 function ask_validator()
 {
     $manager = $this->safebox->get('manager');
     $rules = array('content:required:內容不能為空!');
     $info = Validator::check($rules);
     if ($info == true) {
         Filter::form(array('text' => 'content'));
         if (Req::args('id') != null) {
             Req::args('reply_time', date('Y-m-d H:i:s'));
             Req::args('status', 1);
             Req::args('admin_id', $manager['id']);
         }
     }
     return $info;
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:15,代碼來源:customer.php

示例3: address_save

 public function address_save($redirect = null)
 {
     $rules = array('zip:zip:郵政編碼格式不正確!', 'addr:required:內容不能為空!', 'accept_name:required:收貨人姓名不能為空!,mobile:mobi:手機格式不正確!,phone:phone:電話格式不正確', 'province:[1-9]\\d*:選擇地區必需完成', 'city:[1-9]\\d*:選擇地區必需完成', 'county:[1-9]\\d*:選擇地區必需完成');
     $info = Validator::check($rules);
     if (!is_array($info) && $info == true) {
         Filter::form(array('sql' => 'accept_name|mobile|phone', 'txt' => 'addr', 'int' => 'province|city|county|zip|is_default|id'));
         $is_default = Filter::int(Req::args("is_default"));
         if ($is_default == 1) {
             $this->model->table("address")->where("user_id=" . $this->user['id'])->data(array('is_default' => 0))->update();
         } else {
             Req::args("is_default", "0");
         }
         Req::args("user_id", $this->user['id']);
         $id = Filter::int(Req::args('id'));
         if ($id) {
             $this->model->table("address")->where("id={$id} and user_id=" . $this->user['id'])->update();
         } else {
             $obj = $this->model->table("address")->where('user_id=' . $this->user['id'])->fields("count(*) as total")->find();
             if ($obj && $obj['total'] >= 20) {
                 $this->assign("msg", array("error", '地址最大允許添加20個'));
                 $this->redirect("address_other", false, Req::args());
                 exit;
             } else {
                 $address_id = $this->model->table("address")->insert();
                 $order_status = Session::get("order_status");
                 $order_status['address_id'] = $address_id;
                 Session::set("order_status", $order_status);
             }
         }
         $this->assign("msg", array("success", "地址編輯成功!"));
         Req::args("id", null);
         //$this->redirect("address_other",false);
         if ($redirect == null) {
             echo "<script>parent.location.reload();</script>";
         } else {
             $this->redirect($redirect);
         }
         exit;
     } else {
         $this->assign("msg", array("error", $info['msg']));
         $this->redirect("address_other", false, Req::args());
     }
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:43,代碼來源:simple.php

示例4: voucher_activated

 public function voucher_activated()
 {
     if (!Tiny::app()->checkToken()) {
         $this->redirect("voucher");
     }
     $rules = array('account:required:賬號不能為空!', 'password:required:密碼不能為空!');
     $info = Validator::check($rules);
     if (!is_array($info) && $info == true) {
         Filter::form(array('sql' => 'account'));
         $account = Filter::sql(Req::args("account"));
         $voucher = $this->model->table("voucher")->where("account='{$account}'")->find();
         if ($voucher && $voucher['password'] == Req::args("password")) {
             if (strtotime($voucher['end_time']) > time()) {
                 if ($voucher['status'] == 0) {
                     $this->model->table("voucher")->data(array('user_id' => $this->user['id'], 'is_send' => 1, 'status' => 0))->where("account='{$account}'")->update();
                     $this->redirect("voucher", false, array('msg' => array("success", "優惠券成功激活!")));
                 } else {
                     $this->redirect("voucher", false, array('msg' => array("warning", "此優惠券已使用過!")));
                 }
             } else {
                 //過期
                 $this->redirect("voucher", false, array('msg' => array("warning", "優惠券已過期!")));
             }
         } else {
             //不存在此優惠券
             $this->redirect("voucher", false, array('msg' => array("error", "優惠券賬號或密碼錯誤!")));
         }
     } else {
         //輸入信息有誤
         $this->redirect("voucher", false, array('msg' => array("info", "輸入的信息不格式不正確")));
     }
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:32,代碼來源:ucenter.php


注:本文中的Filter::form方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。