0
回答
有没有搞 ThinkPHP 的,多模块多域名下配置 Smarty 模板引擎无效。求救啊!!!!!!
【腾讯云】校园拼团福利,1核2G服务器10元/月!>>>   

下面是配置 如果我把APP_SUB_DOMAIN_DEPLOY去掉是可以启动Smart的。

Application/Common/Conf/config.php

return array(
            //'配置项'=>'配置值'
            'TMPL_ENGINE_TYPE'=>'Smarty',
            'MODULE_ALLOW_LIST'     =>  array(
                    'Pc',
                    'Wap',
            ),
            'DEFAULT_MODULE'        =>  'Pc',
            'APP_SUB_DOMAIN_DEPLOY'   =>    1, // 开启子域名或者IP配置
            'APP_SUB_DOMAIN_RULES'    =>    array(
                    'test.wap.ldustu.com'=>'Wap',
                    'test.ldustu.com'=>'Pc',
                     ),
            'URL_MODEL'=>1,  //url模式  pathinfo
            'URL_CASE_INSENSITIVE' => true, //URL不区分大小写
            'SESSION_AUTO_START' => true,//是否开启session
            'DB_TYPE'               =>  'mysql',     // 数据库类型
            'DB_HOST'               =>  $_SERVER['LDSN_HOST'], // 服务器地址
            'DB_NAME'               =>  $_SERVER['LDSN_DBNAME'],          // 数据库名
            'DB_USER'               =>  $_SERVER['LDSN_USER'],      // 用户名
            'DB_PWD'                =>  $_SERVER['LDSN_PASSWD'],          // 密码
            'DB_PORT'               =>  '3306',        // 端口
            'DB_PREFIX'             =>  'ldsn_',    // 数据库表前缀
            'DB_CHARSET'            =>  'utf8',      // 数据库编码默认采用utf8

        'TMPL_TEMPLATE_SUFFIX'=>'.tpl',
        'TMPL_ENGINE_CONFIG'=>array(
            'plugins_dir'=>'./Application/Tmpl/Plugins/',
            'template_dir'=>'./Application/Tmpl/Template/',
            'config_dir'=>'./Application/Tmpl/Config/',
            'left_delimiter'=>'{%',
            'right_delimiter'=>'%}'
        ),
    );

下面是报错 test.wap.ldustu.com 明显还是自带的模板引擎

:(
    模板不存在:./Application/Wap/View/Index/index.tpl
    错误位置
    FILE: /home/wwwroot/ldustu/server/ThinkPHP/Library/Think/View.class.php  LINE: 110
    TRACE
    #0 /home/wwwroot/ldustu/server/ThinkPHP/Library/Think/View.class.php(110): E('???????????????...')
    #1 /home/wwwroot/ldustu/server/ThinkPHP/Library/Think/View.class.php(72): Think\View->fetch('', '', '')
    #2 /home/wwwroot/ldustu/server/ThinkPHP/Library/Think/Controller.class.php(56): Think\View->display('', '', '', '', '')
    #3 /home/wwwroot/ldustu/server/Application/Wap/Controller/IndexController.class.php(13): Think\Controller->display()
    #4 [internal function]: Wap\Controller\IndexController->index()
    #5 /home/wwwroot/ldustu/server/ThinkPHP/Library/Think/App.class.php(164): ReflectionMethod->invoke(Object(Wap\Controller\IndexController))
    #6 /home/wwwroot/ldustu/server/ThinkPHP/Library/Think/App.class.php(202): Think\App::exec()
    #7 /home/wwwroot/ldustu/server/ThinkPHP/Library/Think/Think.class.php(120): Think\App::run()
    #8 /home/wwwroot/ldustu/server/ThinkPHP/ThinkPHP.php(97): Think\Think::start()
    #9 /home/wwwroot/ldustu/server/index.php(24): require('/home/wwwroot/l...')
    #10 {main}
举报
明非_
发帖于3年前 0回/703阅
顶部