天天看點

tp5.0在控制器中和在模闆中調用配置檔案中的常量

架構配置檔案config.php中定義

    'view_replace_str'  =>  [

         '__MEMBER__'=> '/static/member',

         '__uploads__'=>'/static/uploads',

     ]

    'TITLE'=> 'title',

控制器中

    $path = config('view_replace_str');

    擷取的是定義常量數組 如:想獲得"__uploads__"的常量

     $uploads = config('view_replace_str')['__uploads__'];

    擷取 'TITLE'

    $title = config('TITLE');

模闆中

{$Think.config.TITLE}