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}

原文:https://blog.csdn.net/liumuhao/article/details/80065513

posted @ 2019-12-13 11:04  橱窗外的小孩  阅读(441)  评论(0编辑  收藏  举报