赶知识网

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

2019-05-22 / 2150次点击 php/mysql/apache

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 !

有用 0 没用 0

Top10

沪ICP备09053415号 © 赶知识网