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


PHP valid::digit方法代碼示例

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


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

示例1: save

 public function save(array $person = array(), $person_id = null)
 {
     $result = array('success' => false, 'error' => '');
     $valid = true;
     $person = $this->get_trimmed_allowed($person, array('space_id', 'email', 'x', 'y', 'active'));
     if (isset($person['space_id']) && !valid::digit($person['space_id'])) {
         $valid = false;
     }
     if (isset($person['email']) && !valid::email($person['email'])) {
         $valid = false;
     }
     if (isset($person['x']) && !valid::numeric($person['x'])) {
         $valid = false;
     }
     if (isset($person['y']) && !valid::numeric($person['y'])) {
         $valid = false;
     }
     if (isset($person['active']) && !valid::digit($person['active'])) {
         $valid = false;
     }
     if ($valid) {
         if ($person_id) {
             //UPDATE
             $this->db->from('people')->set($person)->where(array('id' => (int) $person_id))->update();
             $result['success'] = true;
         } else {
             // INSERT
             $new_person = $this->db->from('people')->set($person)->insert();
             $result['success'] = true;
             $person_id = $new_person->insert_id();
         }
         $person = $this->db->select('people.*')->from('people')->where(array('id' => $person_id))->get();
         $person = $this->result_as_array($person);
         $result['person'] = $person;
     } else {
         $result['error'] = "The supplied data was invalid";
     }
     return $result;
 }
開發者ID:samkeen,項目名稱:Confab-Server,代碼行數:39,代碼來源:person.php

示例2: valid_digit_test

 public function valid_digit_test()
 {
     $this->assert_true_strict(valid::digit('123'))->assert_false_strict(valid::digit('abc'));
 }
開發者ID:enormego,項目名稱:EightPHP,代碼行數:4,代碼來源:validhelper.php

示例3: digit

 /**
  * Tests the valid::digit() function.
  * @dataProvider digit_provider
  * @group core.helpers.valid.digit
  * @test
  */
 public function digit($input_digit, $expected_result)
 {
     $result = valid::digit($input_digit);
     $this->assertEquals($expected_result, $result);
 }
開發者ID:swk,項目名稱:bluebox,代碼行數:11,代碼來源:Helper_Valid_Test.php

示例4: edit

 /**
  * edit an item
  *
  * @param object $setup 
  * @return void
  * @author Andy Bennett
  */
 public function edit($setup = false)
 {
     // acl check
     $data = array('action' => 'edit', 'name' => $this->name, 'role' => Steamauth::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     // are we using a passed id or one POSTed
     $id = isset($setup->id) ? $setup->id : $this->input->post('form_id');
     // set up the defaults
     $d = array('model' => $this->model, 'form_name' => $this->setup['name'] . '_edit', 'form_data' => array(), 'update' => valid::digit($id) ? $id : FALSE);
     $setup = steamcore::array_object($d, $setup);
     // try running the form, throw exception on error (shouldn't happen)
     try {
         steamform_helper::run_form($setup);
     } catch (Exception $e) {
         throw new Kohana_User_Exception('SteamCore Edit Error', $e->getMessage());
     }
 }
開發者ID:AsteriaGamer,項目名稱:steamdriven-kohana,代碼行數:24,代碼來源:Steam.php


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