當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Collection::implode方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Collection::implode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Collection::implode方法的具體用法?PHP Collection::implode怎麽用?PHP Collection::implode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Collection的用法示例。


在下文中一共展示了Collection::implode方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: makeDistributedName

 protected function makeDistributedName()
 {
     $this->md5FileName = md5($this->getModel()->path . microtime(true)) . '.' . collect(explode('.', $this->getModel()->path))->last();
     $this->getModel()->old_name = $this->getModel()->path;
     $this->distributedPathCollection = collect([mb_substr($this->md5FileName, 0, 3), mb_substr($this->md5FileName, 3, 3), mb_substr($this->md5FileName, 6, 3)]);
     $this->getModel()->name = mb_substr($this->md5FileName, 9);
     $this->getModel()->distributed_path = $this->distributedPathCollection->implode($this->pathSeparator);
     $this->getModel()->path = $this->getModel()->distributed_path . $this->pathSeparator . $this->getModel()->name;
     return $this;
 }
開發者ID:garrinar,項目名稱:laravel,代碼行數:10,代碼來源:Adapter.php

示例2: getCreatorsBatch

 public function getCreatorsBatch(Collection $channelIds)
 {
     $ids = $channelIds->implode(',');
     $params = ['id' => $ids, 'maxResults' => 50];
     $result = $this->source->getCreator($params);
     return Channel::createData(collect($result['items']));
 }
開發者ID:Gamespectre,項目名稱:spectator-api,代碼行數:7,代碼來源:ChannelService.php

示例3: lookup

 /**
  * Get the account details of up to 100 users
  *
  * @param Collection $usernames
  * @return Collection
  */
 public function lookup(Collection $usernames)
 {
     $response = $this->client->get('users/lookup.json', ['query' => 'screen_name=' . $usernames->implode(','), 'http_errors' => false]);
     if ($response->getStatusCode() == Response::HTTP_NOT_FOUND) {
         return new Collection();
     }
     return new Collection(json_decode($response->getBody()));
 }
開發者ID:votemike,項目名稱:shorttwittername,代碼行數:14,代碼來源:TwitterApi.php

示例4: getVideosBatch

 public function getVideosBatch(Collection $videoIds, $cacheKey, $force = false)
 {
     $videoIdsString = $videoIds->implode(',');
     $params = ['maxResults' => 50, 'id' => $videoIdsString];
     if ($force === true) {
         Cache::forget($cacheKey);
     }
     $results = Cache::rememberForever($cacheKey, function () use($params) {
         return $this->source->getVideo($params);
     });
     return Video::createData(collect($results['items']));
 }
開發者ID:Gamespectre,項目名稱:spectator-api,代碼行數:12,代碼來源:VideoService.php

示例5: implode

 /**
  *
  *  集合元素 轉換成 字符串
  *
  * implode
  *
  */
 public function implode()
 {
     $val = $this->collection->map(function ($val, $key) {
         return $val['price'];
     });
     debug($val);
     //Desk,Chair,Bookcase,Door
     $implode = $this->collection->implode('product', ',');
     debug($implode);
     //1-2-3-4-5
     $implode = collect([1, 2, 3, 4, 5])->implode('-');
     debug($implode);
     return view('index');
 }
開發者ID:tccLaravel,項目名稱:learn,代碼行數:21,代碼來源:CollectionController.php

示例6: testImplode

 public function testImplode()
 {
     $data = new Collection([['name' => 'taylor', 'email' => 'foo'], ['name' => 'dayle', 'email' => 'bar']]);
     $this->assertEquals('foobar', $data->implode('email'));
     $this->assertEquals('foo,bar', $data->implode('email', ','));
     $data = new Collection(['taylor', 'dayle']);
     $this->assertEquals('taylordayle', $data->implode(''));
     $this->assertEquals('taylor,dayle', $data->implode(','));
 }
開發者ID:sa7bi,項目名稱:euro16,代碼行數:9,代碼來源:SupportCollectionTest.php

示例7: request

 /**
  * Requests the abstract request. But before it does so, it sets a few properties
  * on the request like the extended level, page and it's limit
  *
  * @param AbstractRequest $request
  * @return mixed
  * @throws \Wubs\Trakt\Request\Exception\HttpCodeException\RateLimitExceededException
  * @throws \Wubs\Trakt\Request\Exception\HttpCodeException\ServerErrorException
  * @throws \Wubs\Trakt\Request\Exception\HttpCodeException\ServerUnavailableException
  * @throws \Wubs\Trakt\Request\Exception\HttpCodeException\StatusCodeException
  */
 protected function request(AbstractRequest $request)
 {
     return $request->setExtended($this->extended->implode(','))->setPage($this->page)->setLimit($this->limit)->make($this->clientId, $this->client);
 }
開發者ID:kduma-archive,項目名稱:trakt-api-wrapper,代碼行數:15,代碼來源:Endpoint.php

示例8: addProperties

 private function addProperties(Collection $properties)
 {
     $formatted = new Collection();
     $properties->each(function ($property) use($formatted) {
         $generator = new Property($this->apiNamespace . "\\" . $this->endpoint->implode("\\") . "\\" . $property, $this->filesystem);
         $formatted->push($generator->generate());
     });
     return $this->writeInTemplate('public_properties', "\n" . $formatted->implode("\n\n"));
 }
開發者ID:ValentinGot,項目名稱:trakt-api-wrapper,代碼行數:9,代碼來源:EndpointGenerator.php


注:本文中的Illuminate\Support\Collection::implode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。