duanbamo0127 2018-07-26 10:15
浏览 47
已采纳

Laravel多变量子子域

Currently I have:

Route::domain('{subdomain}.alfa.example.com')->group(function () {

    Route::get('/tet', function ($subdomain) {

        dd($subdomain); 

    });
})

I want to be able to use a route that will respect the following criteria:

  • {variable}.alfa.example.com
  • {variable 1}. (...) .{variable N}.alfa.example.com
  • Variable is not known or defined.
  • N is also not defined and I can have as many dots as I can (as many sub sub domains as I can)

Before asking, I have tried to use ->where('subdomain', '(.*)'); but with no effect.

  • 写回答

1条回答 默认 最新

  • dongyun8075 2018-07-26 10:21
    关注
    Route::domain('{subdomain}.alfa.example.com')->group(function () {
    
        Route::get('/tet', function ($subdomain) {
    
            dd($subdomain); 
    
        })->where('subdomain', '(.*)');
    });
    

    After all I have used ->where('subdomain', '(.*)')

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 (标签-STM32|关键词-智能小车)
  • ¥20 关于#stm32#的问题,请各位专家解答!
  • ¥15 (标签-python)
  • ¥15 第一个已完成,求第二个做法
  • ¥20 搭建awx,试了很多版本都有错
  • ¥15 java corba的客户端该如何指定使用本地某个固定IP去连接服务端?
  • ¥15 activiti工作流问题,求解答
  • ¥15 有人写过RPA后台管理系统么?
  • ¥15 Bioage计算生物学年龄
  • ¥20 如何将FPGA Alveo U50恢复原来出厂设置哇?