URL 中的标签 Laravel 5
Hashtag in URL in Laravel 5
我有一个客户搜索输入。客户有一个地址,有些地址包含数字符号,例如#51 Scout Fuentebella
。我在搜索中包含了地址。
我的路线:
Route::get('customer/search/{input}', 'CustomerController@search');
每当我搜索他们的地址 localhost:8000/customer/search/#51 Sc 时,我都会收到以下错误:
NotFoundHttpException in RouteCollection.php line 161:
哈希标记 (#
) 在 url 中具有特殊含义。它标志着 fragment identifier 的开始,并且只在客户端处理。 #
之后的任何内容都不会发送到服务器。
如果您的 url 需要在其中包含哈希,那么您需要在构建 url 之前对数据进行 url 编码。
#
编码为 %23
,因此对于您的示例,localhost:8000/customer/search/%2351%20Sc
应该可以正常工作。
我有一个客户搜索输入。客户有一个地址,有些地址包含数字符号,例如#51 Scout Fuentebella
。我在搜索中包含了地址。
我的路线:
Route::get('customer/search/{input}', 'CustomerController@search');
每当我搜索他们的地址 localhost:8000/customer/search/#51 Sc 时,我都会收到以下错误:
NotFoundHttpException in RouteCollection.php line 161:
哈希标记 (#
) 在 url 中具有特殊含义。它标志着 fragment identifier 的开始,并且只在客户端处理。 #
之后的任何内容都不会发送到服务器。
如果您的 url 需要在其中包含哈希,那么您需要在构建 url 之前对数据进行 url 编码。
#
编码为 %23
,因此对于您的示例,localhost:8000/customer/search/%2351%20Sc
应该可以正常工作。