laravel使用自定义常量的最佳实践

laravel使用自定义常量的最佳实践

First you make Constants folder inside your app directory.
And then you make constants.php. Define your constants in this file

For Example :


define('ONE', '1');
define('TWO', '2');

And you modify the composer.json

Alternatively, you can use composer.json to load the bootstrap/constants.php file by adding the following code to the “autoload” section, like so:


"autoload": {
    "files": [
        "bootstrap/constants.php"
    ]
}

And update your composer !

有话要说