我将如何路由 url 并锚定到 laravel 中的特定控制器
how would I route url with and anchor to a specific controller in laravel
我继承了一个使用 JSON 并使用散列来扩展框的站点。
这让我在创建共享时遇到问题。
我可以创建一个端点 url,它工作正常,除了网站的编写方式不同,它以不同的方式提取数据。
只有Google有这个问题,因为你只能给它一个分享url来获取信息。
当发布的 url 看起来像这样时,我一直在尝试弄清楚如何将 laravel 路由解析到控制器。
http://somesite.com/#gen/mag/aritcle-name/
我想抓住的部分只是 - #gen
这些都不起作用,但我想我必须做一些逃避...
Route::get('/#gen/mag/', array('uses'=>'content@helloworld'));
Route::get('#gen/mag/', array('uses'=>'content@helloworld'));
Route::get('/\#gen/mag/', array('uses'=>'content@helloworld'));
Route::get('/[#gen]/mag/', array('uses'=>'content@helloworld'));
Route::get('/[\#gen]/mag/', array('uses'=>'content@helloworld'));
Route::get('/(#gen)/mag/', array('uses'=>'content@helloworld'));
Route::get('/(\#gen)/mag/', array('uses'=>'content@helloworld'));
如有任何帮助,我们将不胜感激。
谢谢
安迪
浏览器不会在 url 末尾的 # 之后发送任何内容。这只能在javascript:
中处理
var hashContent = window.location.hash;
我继承了一个使用 JSON 并使用散列来扩展框的站点。 这让我在创建共享时遇到问题。
我可以创建一个端点 url,它工作正常,除了网站的编写方式不同,它以不同的方式提取数据。
只有Google有这个问题,因为你只能给它一个分享url来获取信息。
当发布的 url 看起来像这样时,我一直在尝试弄清楚如何将 laravel 路由解析到控制器。
http://somesite.com/#gen/mag/aritcle-name/
我想抓住的部分只是 - #gen
这些都不起作用,但我想我必须做一些逃避...
Route::get('/#gen/mag/', array('uses'=>'content@helloworld'));
Route::get('#gen/mag/', array('uses'=>'content@helloworld'));
Route::get('/\#gen/mag/', array('uses'=>'content@helloworld'));
Route::get('/[#gen]/mag/', array('uses'=>'content@helloworld'));
Route::get('/[\#gen]/mag/', array('uses'=>'content@helloworld'));
Route::get('/(#gen)/mag/', array('uses'=>'content@helloworld'));
Route::get('/(\#gen)/mag/', array('uses'=>'content@helloworld'));
如有任何帮助,我们将不胜感激。
谢谢
安迪
浏览器不会在 url 末尾的 # 之后发送任何内容。这只能在javascript:
中处理var hashContent = window.location.hash;