admin管理员组

文章数量:1633920

1.开启多应用模块并创建应用模块
    1.获取多应用
        composer require topthink/think-multi-app
    2.获取模板
        composer require topthink/think-view
    3.创建应用模块
        php think build cn
        php think build index
        php think build jp
2.使用nginx重写隐藏index
    location / {
        index index.php index.html error/index.html;
        autoindex  off;
        if (!-e $request_filename) {
            #rewrite  ^(.*)$  /index.php?s=/$1  last;
            rewrite ^/cn(.*)$ /index.php?s=/cn$1;
            rewrite ^/jp(.*)$ /index.php?s=/jp$1;
            rewrite ^((?!/index).*)$ /index.php?s=/index$1; # hide url /index
        }
    }
3.路由添加
    1.tp6多应用路由
        在模块下创建路由文件:/index/route/app.php
    2.创建路由并生成路由对应的地址
        路由:Route::get('profile/:id', 'index/company/profile');
        url生成:<a href="{:url('/profile/1')}">index</a>
        地址:/profile/1.html
        其他模块需要带上目录名称
        路由:Route::get('profile/:id', 'cn/company/profile');
        url生成:<a href="{:url('/cn/profile/1')}">cn-index</a>
        地址:/cn/profile/1.html

 

本文标签: 路由绑定域名