[英]W3C error validating - Bad value for attribute href on element a: Illegal character in query: not a URL code point
I get the bad value for attribute href
on element a
: Illegal character in query: not a URL code point on W3C with the following a
tag: 我得到属性值差
href
元素a
:在查询非法字符:不是W3C的URL代码点具有以下a
标签:
<a href="/edit_booking.php?requestID=84&moduleID=109&no_rooms=2&parks=Central,East&rooms=1,39&weeks=1,3,5,7,9,11,13,15&day=1&semester=1&start_time=09:00&end_time=10:00&length=1&students=100&type=Lecture&Priority=N&metaID=&comments=Crappy Booking&status=1&round=1&date_submitted=2015-02-16 05:01:17&year=2015/2016&" title="This is a link edit the booking"><i class="fa fa-edit"></i></a>
The link is generated from PHP; 该链接由PHP生成; now if the commas are not allowed I can do a replace but I'm not sure if they are allowed in this format or not.
现在如果不允许使用逗号,我可以进行替换,但我不确定是否允许使用这种格式。
Is there something I'm missing, because it looks fine to me? 有什么我想念的,因为它看起来很好吗?
The spaces in the query string are causing the error. 查询字符串中的空格导致错误。 In your sample they appear in two places:
comments=Crappy Booking
and date_submitted=2015-02-16 05:01:17
. 在您的示例中,它们出现在两个地方:
comments=Crappy Booking
和date_submitted=2015-02-16 05:01:17
。
URL-encoding the spaces to %20
, as advised by the validator, allows your markup to validate: 根据验证程序的建议,将空格URL编码为
%20
,允许您的标记验证:
<a href="/edit_booking.php? ... &comments=Crappy%20Booking&status=1&round=1&date_submitted=2015-02-16%2005:01:17&year=2015/2016&" title="This is a link edit the booking"><i class="fa fa-edit"></i></a>
尝试对href属性中传递的URL执行escape()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.