当前位置: 首页>>代码示例>>PHP>>正文


PHP Sanitize::saveInt方法代码示例

本文整理汇总了PHP中Sanitize::saveInt方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitize::saveInt方法的具体用法?PHP Sanitize::saveInt怎么用?PHP Sanitize::saveInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sanitize的用法示例。


在下文中一共展示了Sanitize::saveInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public static function save($value, $type, $standard = null)
 {
     $var = $standard;
     if ($value !== null) {
         if ($type == VAR_DB || $type == VAR_ARR_DB) {
             $var = Sanitize::saveDb($value);
         } elseif ($type == VAR_HTML || $type == VAR_ARR_HTML) {
             $var = Sanitize::saveHTML($value);
         } elseif ($type == VAR_INT || $type == VAR_ARR_INT) {
             $var = Sanitize::saveInt($value);
         } elseif ($type == VAR_ALNUM || $type == VAR_ARR_ALNUM) {
             $var = Sanitize::saveAlNum($value, true);
         } elseif ($type == VAR_URI || $type == VAR_ARR_URI) {
             $var = Sanitize::saveAlNum($value, false);
         } else {
             $var = Sanitize::removeNullByte($value);
         }
     } else {
         if ($standard === null) {
             if ($type == VAR_DB || $type == VAR_ALNUM || $type == VAR_HTML || $type == VAR_URI) {
                 $var = '';
             } elseif ($type == VAR_INT) {
                 $var = 0;
             } elseif ($type == VAR_ARR_INT || $type == VAR_ARR_DB || $type == VAR_ARR_ALNUM || $type == VAR_ARR_NONE || $type == VAR_ARR_HTML || $type == VAR_ARR_URI) {
                 $var = array();
             } else {
                 $var = null;
             }
         }
     }
     return $var;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:32,代码来源:class.Sanitize.php

示例2: set

 /**
  * Updates the value for the configuration key specified as parameter.
  *
  * If the third parameter is null (it is the default value) the script tries to get
  * the value by name (without group!) from the input data (query string). If no data is found
  * the default value from Variables::get() for the specified type will be used.
  *
  * This function throws a notice if the key is not found.
  *
  * The data won't be saved by this function! You have to call Config::save() for this!
  *
  * @see Variables::get()
  * @see Config::save()
  * @param string Config key in the format Group.Key
  * @param int Type of variable (one of the standard types that are accepted by Request::get().
  * @param mixed Value to change to specified config key.
  **/
 public static function set($key, $type = VAR_NONE, $value = null)
 {
     if (self::$data == null) {
         self::baseConfig();
     }
     list($sgroup, $name) = explode('.', $key, 2);
     if ($value == null) {
         $value = Request::get($name, $type);
     }
     if (isset(self::$data[$key]) == true) {
         self::$data[$key] = $value;
         if ($type == VAR_INT || $type == VAR_ARR_INT) {
             $value = Sanitize::saveInt($value);
         }
         self::$changes[$key] = array('key' => $key, 'value' => $value, 'type' => $type);
     } else {
         Core::throwError("Config::set() - Specified key does not exist.");
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:36,代码来源:class.Config.php


注:本文中的Sanitize::saveInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。