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


PHP Arr::collapse方法代码示例

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


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

示例1: explode

 /**
  * Get an item from an array or object using "dot" notation.
  *
  * @param  mixed   $target
  * @param  string|array  $key
  * @param  mixed   $default
  * @return mixed
  */
 function data_get($target, $key, $default = null)
 {
     if (is_null($key)) {
         return $target;
     }
     $key = is_array($key) ? $key : explode('.', $key);
     while (($segment = array_shift($key)) !== null) {
         if ($segment === '*') {
             if ($target instanceof Collection) {
                 $target = $target->all();
             } elseif (!is_array($target)) {
                 return value($default);
             }
             $result = Arr::pluck($target, $key);
             return in_array('*', $key) ? Arr::collapse($result) : $result;
         }
         if (Arr::accessible($target) && Arr::exists($target, $segment)) {
             $target = $target[$segment];
         } elseif (is_object($target) && isset($target->{$segment})) {
             $target = $target->{$segment};
         } else {
             return value($default);
         }
     }
     return $target;
 }
开发者ID:sa7bi,项目名称:euro16,代码行数:34,代码来源:helpers.php

示例2: init

 /**
  * @return $this
  */
 public function init()
 {
     $config = Arr::collapse([$this->loadIlluminateConfiguration(), $this->loadFiledConfiguration()]);
     $this->application->instance('env', 'production');
     $this->application->instance('config', new Repository($config));
     $this->application->registerConfiguredProviders();
     $this->application->singleton(HttpKernelContract::class, HttpKernel::class);
     $this->application->singleton(ConsoleKernelContract::class, ConsoleKernel::class);
     $this->application->singleton(ExceptionHandler::class, Handler::class);
     if ($this->application->isInstalled()) {
         $this->application->register(ThemeServiceProvider::class);
         $this->application->register(MenuServiceProvider::class);
         $this->application->register(CategoryServiceProvider::class);
         $this->application->register(ArticleServiceProvider::class);
         $this->application->register(HttpServiceProvider::class);
         $this->application->register(PageServiceProvider::class);
         $this->application->register(AdminServiceProvider::class);
     } else {
         $this->application->register(InstallServiceProvider::class);
     }
     return $this;
 }
开发者ID:darrengopower,项目名称:framework,代码行数:25,代码来源:Server.php

示例3: collapse

 /**
  * Collapse the collection of items into a single array.
  *
  * @return static
  */
 public function collapse()
 {
     return new static(Arr::collapse($this->items));
 }
开发者ID:jeandrocouto,项目名称:warmupdelivery,代码行数:9,代码来源:Collection.php

示例4:

 /**
  * Collapse an array of arrays into a single array.
  *
  * @param  array|\ArrayAccess  $array
  * @return array
  */
 function array_collapse($array)
 {
     return Arr::collapse($array);
 }
开发者ID:jordeytje,项目名称:vlamteddybeer,代码行数:10,代码来源:helpers.php


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