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


PHP array_map_recursive函数代码示例

本文整理汇总了PHP中array_map_recursive函数的典型用法代码示例。如果您正苦于以下问题:PHP array_map_recursive函数的具体用法?PHP array_map_recursive怎么用?PHP array_map_recursive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: PsychoCMS

 function PsychoCMS($conf = array())
 {
     // PHP4
     $conf += array('dbhandle' => null, 'session' => null, 'plugin_dir' => '');
     if (empty($conf['plugin_dir'])) {
         $conf['plugin_dir'] = catfile(PS_ROOTDIR, 'plugins');
     }
     $this->conf = $conf;
     // initialize input; strip those annoying slashes if needed.
     // but lets be nice to the environment and not actually touch the global arrays.
     if (get_magic_quotes_gpc()) {
         $this->input = array_map_recursive('stripslashes', array_merge($_GET, $_POST));
         $this->file = array_map_recursive('stripslashes', $_FILES);
         $this->cookie = array_map_recursive('stripslashes', $_COOKIE);
     } else {
         $this->input = array_merge($_GET, $_POST);
         $this->file = $_FILES;
         $this->cookie = $_COOKIE;
     }
     // initialize the database connection
     if (isset($conf['dbhandle']) and is_object($conf['dbhandle'])) {
         $this->db =& $conf['dbhandle'];
     } else {
         require_once dirname(__FILE__) . "/class_DB.php";
         $this->db = DB::create($conf);
     }
     // where are our plugins?
     $this->plugin_dir = $conf['plugin_dir'];
 }
开发者ID:Nerus87,项目名称:PsychoStats,代码行数:29,代码来源:class_CMS.php

示例2: array_map_recursive

 function array_map_recursive($function, &$data)
 {
     foreach ($data as $i => $item) {
         $data[$i] = is_array($item) ? array_map_recursive($function, $item) : $function($item);
     }
     return $data;
 }
开发者ID:dautushenka,项目名称:car-market,代码行数:7,代码来源:functions.php

示例3: array_map_recursive

function array_map_recursive( $func, $arr ) {
    $newArr = array();
    foreach( $arr as $key => $value ) {
        $newArr[ $key ] = ( is_array( $value ) ? array_map_recursive( $func, $value ) : $func( $value ) );
    }
    return $newArr;
}
开发者ID:nixonch,项目名称:a2billing,代码行数:7,代码来源:protect_sqli.php

示例4: array_map_recursive

 function array_map_recursive($fn, $arr)
 {
     $rarr = array();
     foreach ($arr as $k => $v) {
         $rarr[$k] = is_array($v) ? array_map_recursive($fn, $v) : (is_array($fn) ? call_user_func($fn, $v) : $fn($v));
     }
     return $rarr;
 }
开发者ID:Blu2z,项目名称:implsk,代码行数:8,代码来源:nc_input.class.php

示例5: array_map_recursive

function array_map_recursive($func, $arr)
{
    $out = [];
    foreach ($arr as $k => $x) {
        $out[$k] = is_array($x) ? array_map_recursive($func, $x) : $func($x);
    }
    return $out;
}
开发者ID:qious,项目名称:Hnust,代码行数:8,代码来源:Functions.php

示例6: array_map_recursive

function array_map_recursive(callable $closure, array $array)
{
    $buf = [];
    foreach ($array as $k => $v) {
        $buf[$k] = is_array($v) ? array_map_recursive($closure, $v) : $closure($v);
    }
    return $buf;
}
开发者ID:tany,项目名称:php-note,代码行数:8,代码来源:func.php

示例7: array_map_recursive

function array_map_recursive($func, $arr)
{
    $newArr = array();
    foreach ($arr as $key => $value) {
        $newArr[$key] = is_array($value) || $value instanceof ArrayAccess ? array_map_recursive($func, $value) : call_user_func($func, $value);
    }
    return $newArr;
}
开发者ID:reinfire,项目名称:arfooo,代码行数:8,代码来源:Core.php

示例8: _crud_index_before_insert_or_update

 /**
  * _crud_option_before_insert_or_update 
  *
  * Do before insert
  */
 function _crud_index_before_insert_or_update($post_array, $primary_key)
 {
     $this->load->helper('date');
     $this->load->helper('security');
     $post_array = array_map_recursive('xss_clean', $post_array);
     $post_array = array_map_recursive('strip_tags', $post_array);
     $post_array['updated'] = date('Y-m-d H:i:s', now());
     return $post_array;
 }
开发者ID:groucho75,项目名称:ci_html5_auth_crud,代码行数:14,代码来源:crud.php

示例9: array_map_recursive

 /**
  * Applies the callback to the elements of the given arrays, recursively
  * @param  callable $callback Callback function to run for each element in each array.
  * @param  array    $value    An array to run through the callback function.
  * @return array              Returns an array containing all the elements of array1 after applying the callback function to each one.
  */
 function array_map_recursive($callback, $value)
 {
     if (is_array($value)) {
         return array_map(function ($value) use($callback) {
             return array_map_recursive($callback, $value);
         }, $value);
     }
     return $callback($value);
 }
开发者ID:usebeagle,项目名称:common,代码行数:15,代码来源:array_map_recursive.php

示例10: array_map_recursive

 private function array_map_recursive($callback, $array) {
     foreach ($array as $key => $value) {
         if (is_object($array[$key])) {
             $array[$key] = array_map_recursive($callback, $array[$key]);
         } else {
             $array[$key] = call_user_func($callback, $array[$key]);
         }
     }
     return $array;
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:10,代码来源:HttpWrapper.php

示例11: array_map_recursive

 function array_map_recursive($func, $arr)
 {
     $a = array();
     if (is_array($arr)) {
         foreach ($arr as $k => $v) {
             $a[$k] = is_array($v) ? array_map_recursive($func, $v) : $func($v);
         }
     }
     return $a;
 }
开发者ID:noackorama,项目名称:source-talk-2012,代码行数:10,代码来源:bootstrap.php

示例12: array_map_recursive

 private function array_map_recursive($func, $array)
 {
     foreach ($array as $key => $val) {
         if (is_array($array[$key])) {
             $array[$key] = array_map_recursive($func, $array[$key]);
         } else {
             $array[$key] = call_user_func($func, $val);
         }
     }
     return $array;
 }
开发者ID:animir,项目名称:html-to-array,代码行数:11,代码来源:Translator.php

示例13: array_map_recursive

function array_map_recursive($callback, $array)
{
    $ret = array();
    if (!is_array($array)) {
        return $callback($array);
    }
    foreach ($array as $key => $val) {
        $ret[$key] = array_map_recursive($callback, $val);
    }
    return $ret;
}
开发者ID:l3oncoder,项目名称:TorrentTrader,代码行数:11,代码来源:announce.php

示例14: _empty

 public function _empty($name, $args)
 {
     require_once APP_PATH . CONTROLLER_NAME . '/' . 'Controller' . '/' . CONTROLLER_NAME . 'Controller.class.php';
     $controller = A('Admin/' . CONTROLLER_NAME);
     $action = ACTION_NAME;
     try {
         $method = new \ReflectionMethod($controller, $name);
         // URL参数绑定检测
         if ($method->getNumberOfParameters() > 0 && C('URL_PARAMS_BIND')) {
             switch ($_SERVER['REQUEST_METHOD']) {
                 case 'POST':
                     $vars = array_merge($_GET, $_POST);
                     break;
                 case 'PUT':
                     parse_str(file_get_contents('php://input'), $vars);
                     break;
                 default:
                     $vars = $_GET;
             }
             $params = $method->getParameters();
             $paramsBindType = C('URL_PARAMS_BIND_TYPE');
             foreach ($params as $param) {
                 $name = $param->getName();
                 if (1 == $paramsBindType && !empty($vars)) {
                     $args[] = array_shift($vars);
                 } elseif (0 == $paramsBindType && isset($vars[$name])) {
                     $args[] = $vars[$name];
                 } elseif ($param->isDefaultValueAvailable()) {
                     $args[] = $param->getDefaultValue();
                 } else {
                     E(L('_PARAM_ERROR_') . ':' . $name);
                 }
             }
             // 开启绑定参数过滤机制
             if (C('URL_PARAMS_SAFE')) {
                 array_walk_recursive($args, 'filter_exp');
                 $filters = C('URL_PARAMS_FILTER') ?: C('DEFAULT_FILTER');
                 if ($filters) {
                     $filters = explode(',', $filters);
                     foreach ($filters as $filter) {
                         $args = array_map_recursive($filter, $args);
                         // 参数过滤
                     }
                 }
             }
             $method->invokeArgs($controller, $args);
         } else {
             $method->invoke($controller);
         }
     } catch (\ReflectionException $e) {
         $this->error('404,您访问的页面不存在。');
     }
 }
开发者ID:xiaolw,项目名称:wacms,代码行数:53,代码来源:EmptyController.class.php

示例15: toBSON

 public function toBSON()
 {
     return array_map_recursive(function ($item) {
         if (is_object($item) && ($class = get_class($item))) {
             if ($item instanceof \MongoDB\BSON\Serializable) {
                 return $item->bsonSerialize();
             } elseif ($class === 'DateTime') {
                 return new \MongoDB\BSON\UTCDateTime($item->getTimeStamp() . '000');
             }
         }
         return $item;
     }, $this->_data);
 }
开发者ID:tany,项目名称:php-note,代码行数:13,代码来源:Model.php


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