LoginSignup
0
0

More than 5 years have passed since last update.

Yiiでアプリケーション内で使う定数を設定する

Posted at

/application_root/config/params.php

<?php
return [
    'adminEmail' => 'admin@example.com',
    'hoge' => 'hoge'
];

取り出す時はaction内で

Yii::$app->params['hoge'];

みたいにして取り出す。

一応main.phpに以下の記述が必要
(composerからインストールした場合は設定済みになっているかと思います)

config/main.php

$params = array_merge(
    require(__DIR__ . '/params.php')
);
0
0
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
0