简体   繁体   English

W3C错误验证 - 元素a上属性href的错误值:查询中的非法字符:不是URL代码点

[英]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&amp;moduleID=109&amp;no_rooms=2&amp;parks=Central,East&amp;rooms=1,39&amp;weeks=1,3,5,7,9,11,13,15&amp;day=1&amp;semester=1&amp;start_time=09:00&amp;end_time=10:00&amp;length=1&amp;students=100&amp;type=Lecture&amp;Priority=N&amp;metaID=&amp;comments=Crappy Booking&amp;status=1&amp;round=1&amp;date_submitted=2015-02-16 05:01:17&amp;year=2015/2016&amp;" 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 Bookingdate_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? ... &amp;comments=Crappy%20Booking&amp;status=1&amp;round=1&amp;date_submitted=2015-02-16%2005:01:17&amp;year=2015/2016&amp;" title="This is a link edit the booking"><i class="fa fa-edit"></i></a>

尝试对href属性中传递的URL执行escape()

Using PHP , rawurlencode will do the job (percent-encoding) for you. 使用PHPrawurlencode将为您完成工作(百分比编码)。

A space will be encoded to %20 ( RFC 3986 ). 空格将编码为%20RFC 3986 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 W3C验证查询中的非法字符:不是URL代码点 - W3C validation Illegal character in query: not a URL code point W3C标记验证-PHP查询中的非法字符:不是URL代码点 - W3C Markup Validation - Illegal character in PHP query: not a URL code point href属性中的值错误:“查询中的非法字符:&gt;” - Bad value in a href attribute: “Illegal character in query: >” W3C标记验证-路径段中的非法字符:不是URL代码点 - W3C Markup Validation - Illegal character in path segment: not a URL code point W3C 验证器:元素 a 上的属性 href 值错误:缺少方案 - W3C validator: Bad value for attribute href on element a: Missing scheme W3C验证错误:值错误 - W3C validation Error: Bad value W3C验证错误:“元素meta上属性http-equiv的值X-XRDS-Location错误” - W3C validation error: “Bad value X-XRDS-Location for attribute http-equiv on element meta” 在角度js {{i.link}}中,元素a的属性href显示w3c验证错误 - In angular js {{i.link}} for attribute href on element a showing w3c validation error W3C验证:此时元素a上不允许属性alt - W3C Validation: Attribute alt not allowed on element a at this point 我不明白这个错误“此时元素 iframe 上不允许使用属性 iframe”。 w3c - I don't understand this error "Attribute iframe not allowed on element iframe at this point." w3c
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM