[英]Laravel route query string to angular
I have an angular app that uses laravel on the back end. 我有一个在后端使用laravel的角度应用程序。 I use a regular expression to send a number of URLs to the angular app. 我使用正则表达式将多个URL发送到angular应用程序。 Once there, the app itself uses the URL to display the proper module. 到达该位置后,应用程序本身将使用URL来显示正确的模块。
I am now trying to allow my site to receive input from another site and that input will come in the form of a URL with a query string such as ... 我现在正试图允许我的站点从另一个站点接收输入,并且该输入将以带有查询字符串(例如...)的URL的形式出现。
www.myurl.com/?thisId=23432&thisSection=4232
I cannot get this URL to register properly as one that is sent to the angular app. 我无法获得将该URL正确注册为发送到angular应用程序的URL。 Is there a proper way in Laravel to say that a URL with a query string should go to address x? Laravel中有没有一种正确的方法可以说带有查询字符串的URL应该到达地址x?
Here are some things that I have tried so far ... 到目前为止,我已经尝试了一些操作...
Route::get('/?thisId', 'MyController@mainApp');
Route::get('/\?thisId', 'MyController@mainApp');
Route::get('/{any?}', 'MyController@mainApp')->where('any', '^(?thisId[0-9a-zA-Z\=]');
Route::get('/{any?}', 'MyController@mainApp')->where('any', '^(\?thisId[0-9a-zA-Z\=]');
Not sure what to try now. 不知道现在要尝试什么。 Any suggestions on how to handle this? 有关如何处理此问题的任何建议?
Laravel Route
parameter scheme is not like this: Laravel Route
参数方案不是这样的:
www.myurl.com/?thisId=23432&thisSection=4232
It works like: 它的工作原理如下:
www.myurl.com/thisId/23432/thisSection/4232
And for this the route is like: 为此,路线类似于:
Route::get('thisId/{thisId}/thisSection/{thisSection}', function ($thisId, $thisSection) {
//
});
It should be like this .. 应该是这样..
URL 网址
www.myurl.com/thisId/123
ROUTES ROUTES
Route::get('/thisId/{id?}', 'MyController@mainApp')->where('id', '[0-9a-zA-Z\=]');
CONTROLLER CONTROLLER
public function mainApp($thisId='defaultifnoinput')
{
// do some thing with $thisId;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.