edire
V2EX  ›  问与答

有没有搞 ThinkPHP 的,多模块多域名下配置 Smarty 模板引擎无效。求救啊!!!!!!

  •  
  •   edire · Mar 12, 2015 · 2934 views
    This topic created in 4110 days ago, the information mentioned may be changed or developed.

    下面是配置 如果我把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}
    
    4 replies    2015-03-12 10:24:43 +08:00
    lmaq
        1
    lmaq  
       Mar 12, 2015
    模板不存在:./Application/Wap/View/Index/index.tpl
    alex321
        2
    alex321  
       Mar 12, 2015
    人家已经说了,模板不存在;再,注意 linux 下这货的大小写问题。
    另,ThinkPHP 真是众多坑,虽说因为国产和文档问题被众多人夸赞,其实,其实,真的其实。
    zts1993
        3
    zts1993  
       Mar 12, 2015
    @alex321 ThinkPHP 的坑,通常出没于非常用功能,很多人只是用了一小部分,所以没才到坑而已。。。
    edire
        4
    edire  
    OP
       Mar 12, 2015
    @lmaq
    @alex321

    不是,这明显不是走的Smarty模板引擎。如果我把 子域名 关闭 访问 域名就可以走Smarty引擎,不过访问不到模块。如果后面带上 /Wap 访问单个模块,就又报上面的错误
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5232 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 07:11 · PVG 15:11 · LAX 00:11 · JFK 03:11
    ♥ Do have faith in what you're doing.