当前位置: 首页>>代码示例>>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;未经允许,请勿转载。