我希望使用https
或http
从我的控制器函数返回一个视图,具体取决于变量。我不希望将redirect
改为https
或http
,我只想使用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');
}
}
答案 0 :(得分:-2)
首先我理解错误的问题。返回视图只返回页面上的内容,而View与协议没有任何关系。
如果需要更改协议,则只能通过您喜欢的方式重定向到https或http。