Laravel条件视图的https

时间:2015-04-20 09:06:22

标签: php laravel https laravel-routing symfony-http-foundation

我希望使用httpshttp从我的控制器函数返回一个视图,具体取决于变量。我不希望将redirect改为httpshttp,我只想使用View::make()Response::view()功能。有可能吗?

示例:

public function getSiteContent($https = false)
{
  if($https===true){
    //return to secure https url
    return View::make('sites.content');
  }
  else{
    //return to http url
    return View::make('sites.content');
  }
}

1 个答案:

答案 0 :(得分:-2)

首先我理解错误的问题。返回视图只返回页面上的内容,而View与协议没有任何关系。

如果需要更改协议,则只能通过您喜欢的方式重定向到https或http。

相关问题