laravel 引入自定义文件,functions.php

例如文件在: app/Common/functions.php

找到app/bootstrap/autoload.php 文件在下面增加一行:

<?php

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so we do not have to manually load any of
| our application's PHP classes. It just feels great to relax.
|
*/

require __DIR__.'/../vendor/autoload.php';
require __DIR__.'/../app/Common/functions.php';  // 新增加的文件