Laravel路由查询字符串到角

问题描述:

我有一个角度的应用程序,在后端使用laravel。我使用正则表达式将大量网址发送到角度应用程序。一旦那里,应用程序本身使用URL来显示适当的模块。Laravel路由查询字符串到角

现在我试图让我的网站从其他网站接收输入和输入将要与查询字符串,如URL的形式...

www.myurl.com/?thisId=23432&thisSection=4232 

我不能得到这个网址正确注册为一个发送到角度应用程序。 Laravel有没有一种合适的方式来说明一个带有查询字符串的URL应该到达地址x?

这里有一些事情,我到目前为止已经试过......

Route::get('/?thisId', '[email protected]'); 
Route::get('/\?thisId', '[email protected]'); 

Route::get('/{any?}', '[email protected]')->where('any', '^(?thisId[0-9a-zA-Z\=]'); 
Route::get('/{any?}', '[email protected]')->where('any', '^(\?thisId[0-9a-zA-Z\=]'); 

不知道现在什么尝试。有关如何处理这个问题的任何建议?

+0

* I C annot得到这个URL正确注册为一个发送到角应用程序* - 你是如何“发送”到角?..? –

+0

有几条路由被发送到单页角度应用的URL。这是为了防止用户在其中一个URL中输入网站。一旦在应用程序中,一切都以不同方式处理。 –

+0

是你控制范围之外的laravel部分?另外,只是一个侧面说明'www.myurl.com/?thisId = 23432&thisSection = 4232'可以将** url重写入'www.myurl.com/this/23432/thisSection = 4232',因为实际上大多数php的实现仍然接受基于查询字符串的请求,而斜杠来自url重写。 –

Laravel Route参数方案是不是这样:

www.myurl.com/?thisId=23432&thisSection=4232 

它是这样工作:

www.myurl.com/thisId/23432/thisSection/4232 

而且这个路线是这样的:

Route::get('thisId/{thisId}/thisSection/{thisSection}', function ($thisId, $thisSection) { 
    // 
}); 

Reference

+0

欣赏帮助,但网址来自外部来源。我没有控制它的结构,它有一个上面描述的形式的查询字符串。 –

+0

@JoshuaFoxworth你的意思是来自外部来源*或许你可以详细阐述你的设置/案例。 –

+0

一个单独的网站在iframe中从我的网站中拉出一个页面。要确定要显示的正确页面,他们会将查询字符串URL发送到我的网站。我无法更改此 –

它应该是这样..

URL

www.myurl.com/thisId/123 

ROUTES

Route::get('/thisId/{id?}', '[email protected]')->where('id', '[0-9a-zA-Z\=]'); 

控制器

public function mainApp($thisId='defaultifnoinput') 
{ 
    // do some thing with $thisId; 
} 
+0

感谢帮助,但URL来自外部来源。按照您描述的方式设置我的网站时,传入的网址具有查询字符串。 –