0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

config内で連想配列を参照,変更する場合

Posted at
config/○○.php

    'hoge' => [
        'id' => env('KEY'),  
        'secret' => env('SECRET'),  
        'redirect' => env('CALLBACK'),
    ],

があった場合


$id = config('○○.php.hoge.id');//configの値や文字列を$idに代入
config(['○○.php.hoge.id','△△']);//configに代入したい値や文字列を'△△'に記述

これでできます

配列のネストした要素をドット記法で取得できるらしいです

以下laravel非公式日本語ドキュメント引用
config関数は設定変数の値を取得します。設定値はファイル名とアクセスしたいオプションを「ドット」記法で指定します。デフォルト値が指定でき、設定オプションが存在しない時に返されます。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?