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


PHP Arr::set方法代码示例

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


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

示例1: session

 /**
  * Get or set our $_SESSION var via . sperated array access
  *
  * @param key string A period seperated string of array keys and values
  * @param value string The value to be set
  *
  * @return array
  */
 static function session($key, $value = null)
 {
     if (!is_null($value)) {
         Arr::set($_SESSION, ID . '.' . $key, $value);
     }
     return Arr::get($_SESSION, ID . '.' . $key);
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:15,代码来源:input.php

示例2: setup_configs_template_body

 public static function setup_configs_template_body($configs)
 {
     foreach ($configs as $type => $types) {
         foreach ($types as $module => $modules) {
             foreach ($modules as $item_key => $items) {
                 if (!isset($items['body'])) {
                     continue;
                 }
                 if (!is_array($items['body'])) {
                     continue;
                 }
                 if (!empty($items['body']['default']['file'])) {
                     $ext = !empty($items['format']) ? $items['format'] : 'php';
                     $body = file_get_contents(sprintf('%sviews/%s.%s', APPPATH, $items['body']['default']['file'], $ext));
                 } elseif (!empty($items['body']['default']['value'])) {
                     $body = $items['body']['default']['value'];
                 } else {
                     continue;
                 }
                 $key = implode('.', array($type, $module, $item_key, 'body'));
                 Arr::set($configs, $key, $body);
             }
         }
     }
     return $configs;
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:26,代码来源:config.php

示例3: set

 /**
  * Set a configuration item.
  *
  * @param  string  $key
  * @param  mixed   $value
  * @return void
  */
 public static function set($key, $value)
 {
     list($module, $file, $key) = static::parse($key);
     if (!static::load($module, $file)) {
         throw new \Exception("Error setting configuration option. Configuration file [{$file}] is not defined.");
     }
     Arr::set(static::$items[$module][$file], $key, $value);
 }
开发者ID:hpaul,项目名称:Google-short,代码行数:15,代码来源:config.php

示例4: update

 public function update(array $menu)
 {
     // Set children
     $root = \Config::get('menu/' . $this->id, array());
     \Arr::set($root, 'children', $menu);
     // Save to file
     return \Config::save('menu/' . $this->id, $root);
 }
开发者ID:indigophp,项目名称:fuel-menu,代码行数:8,代码来源:static.php

示例5: set

 /**
  * Set a configuration item
  *
  * Similar to the Config::get method, this function uses "dot" notation to
  * allow for setting of configuration items. Setting a configuration item does
  * not save the configuration permanently, only for the life of this request.
  *
  * ## Usage
  *
  *     Config::set('file.key', $value);
  *
  * @param    string           The "dot" notation key to be set
  * @param    mixed            The value of the key to be set
  * @return   void             No value is returned
  */
 public static function set($key, $value)
 {
     list($package, $file, $key) = static::parse($key);
     if (!static::load($package, $file)) {
         throw new \OutOfBoundsException('Error setting configuration option. Configuration file [%s] is not defined.', $file);
     }
     Arr::set(static::$items[$package][$file], $key, $value);
 }
开发者ID:nerdsrescueme,项目名称:Core,代码行数:23,代码来源:config.php

示例6: set

 /**
  * 设置值
  *
  * @param $name 类型如get.name,post.id
  * @param $value
  *
  * @return bool
  */
 public function set($name, $value)
 {
     $info = explode('.', $name);
     $action = strtoupper(array_shift($info));
     if (isset(self::$items[$action])) {
         self::$items[$action] = Arr::set(self::$items[$action], implode('.', $info), $value);
         return true;
     }
 }
开发者ID:houdunwang,项目名称:hdphp,代码行数:17,代码来源:Request.php

示例7: set_config

 /**
  * Sets a config item
  *
  * @param mixed $key   Config key or array to merge
  * @param mixed $value Config value
  *
  * @return this
  */
 public function set_config($key, $value = null)
 {
     if (is_array($key)) {
         $this->config = \Arr::merge($this->config, $key);
     } else {
         \Arr::set($this->config, $key, $value);
     }
     return $this;
 }
开发者ID:indigophp,项目名称:fuel-core,代码行数:17,代码来源:theme.php

示例8: newFromBuilder

 /**
  * @param array $attributes
  * @return static
  */
 public function newFromBuilder($attributes = [], $connection = null)
 {
     $attributes = (array) $attributes;
     $nestedData = [];
     foreach ($attributes as $key => $value) {
         $key = str_replace('---', '.', $key);
         Arr::set($nestedData, $key, $value);
     }
     $instance = $this->buildForeignEntity(null, $nestedData);
     return $instance;
 }
开发者ID:grigory51,项目名称:with-join,代码行数:15,代码来源:WithJoinTrait.php

示例9: action_popup

 public function action_popup()
 {
     if (empty($_GET['url'])) {
         foreach ($this->config['fields'] as $key => $field) {
             if (\Arr::get($field, 'form.default') && !isset($_GET[$key])) {
                 \Arr::set($_GET, $key, \Arr::get($field, 'form.default'));
             }
         }
     }
     return parent::action_popup();
 }
开发者ID:novius,项目名称:novius_social_widget,代码行数:11,代码来源:facebook.ctrl.php

示例10: set_config

 /**
  * Sets a config value
  *
  * @param   string
  * @param   mixed
  * @return  Fieldset  this, to allow chaining
  */
 public function set_config($config, $value = null)
 {
     $config = is_array($config) ? $config : array($config => $value);
     foreach ($config as $key => $value) {
         if (strpos($key, '.') === false) {
             $this->config[$key] = $value;
         } else {
             \Arr::set($this->config, $key, $value);
         }
     }
     return $this;
 }
开发者ID:codechap,项目名称:mygate,代码行数:19,代码来源:Connection.php

示例11: _init

 public static function _init()
 {
     // static::$_properties = \Arr::merge(static::$_properties, array(
     // 	'default_id' => array(
     // 		'form' => array(
     // 			'options' => function($model) {
     // 				$model->items;
     // 				$model = $model->to_array();
     // 				return \Arr::pluck($model['items'], 'name', 'id');
     // 			}
     // 		)
     // 	),
     // ));
     if (\Auth::has_access('enum.enum[all]')) {
         \Arr::set(static::$_properties, 'read_only.form', array('type' => 'checkbox', 'template' => 'switch', 'options' => array(gettext('No'), gettext('Yes'))));
     }
 }
开发者ID:indigophp,项目名称:indigo-enum,代码行数:17,代码来源:enum.php

示例12: set_global_offset

 /**
  * viewファイルからの全体オフセット量追加
  * 
  * このメソッドによる変更はインスタンスが破棄されるまで有効です
  * 
  * @param real $x 水平方向のオフセット量
  * @param real $y 垂直方向のオフセット量
  */
 public function set_global_offset($x = 0.0, $y = 0.0)
 {
     \Arr::set($this->config, 'global_offset.x', \Arr::get($this->config, 'global_offset.x') + $x);
     \Arr::set($this->config, 'global_offset.y', \Arr::get($this->config, 'global_offset.y') + $y);
 }
开发者ID:rrrz,项目名称:tcpdf-wrapper,代码行数:13,代码来源:offset.php

示例13: set

 /**
  * Set new or update existing config variable
  *
  *  <code>
  *      Config::set('site.title', 'value');
  *  </code>
  *
  * @access public
  * @param string $key   Key
  * @param mixed  $value Value
  */
 public static function set($key, $value)
 {
     Arr::set(static::$config, $key, $value);
 }
开发者ID:xamedow,项目名称:bqs-site,代码行数:15,代码来源:Config.php

示例14: array_set

 /**
  * Set an array item to a given value using "dot" notation.
  *
  * If no key is given to the method, the entire array will be replaced.
  *
  * @param  array   $array
  * @param  string  $key
  * @param  mixed   $value
  * @return array
  */
 function array_set(&$array, $key, $value)
 {
     return Arr::set($array, $key, $value);
 }
开发者ID:runningjack,项目名称:busticketAPI1,代码行数:14,代码来源:helpers.php

示例15: set_flash

 /**
  * set session flash variables
  *
  * @param	string	name of the variable to set
  * @param	mixed	value
  * @access	public
  * @return	Fuel\Core\Session_Driver
  */
 public function set_flash($name, $value)
 {
     if (strpos($name, '.') !== false) {
         $keys = explode('.', $name, 2);
         $name = array_shift($keys);
     } else {
         $keys = false;
     }
     if ($keys) {
         if (isset($this->flash[$this->config['flash_id'] . '::' . $name]['value'])) {
             $this->flash[$this->config['flash_id'] . '::' . $name]['state'] = 'new';
         } else {
             $this->flash[$this->config['flash_id'] . '::' . $name] = array('state' => 'new', 'value' => array());
         }
         \Arr::set($this->flash[$this->config['flash_id'] . '::' . $name]['value'], $keys[0], $value);
     } else {
         $this->flash[$this->config['flash_id'] . '::' . $name] = array('state' => 'new', 'value' => $value);
     }
     return $this;
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:28,代码来源:driver.php


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