简体   繁体   English

W3C标记验证-PHP查询中的非法字符:不是URL代码点

[英]W3C Markup Validation - Illegal character in PHP query: not a URL code point

What's the problem? 有什么问题?

I am currently trying to validate my client's website, but cannot resolve the following issue. 我目前正在尝试验证客户的网站,但无法解决以下问题。

Bad value /php/captcha_code_file.php?rand= for attribute src on element img: Illegal character in query: not a URL code point. 元素img上属性src的值/php/captcha_code_file.php?rand=的值错误:查询中的非法字符:不是URL代码点。

The full line that the validator points to can be found below. 验证者指向的完整行可以在下面找到。

<html>
<!-- ... -->
<img src="/php/xyz.php?rand=<?php echo rand();?>" id="captchaimg" alt="captcha"><br/>
<!-- ... -->
</html>

What have I done? 我做了什么?

It's my understanding that any spaces in URLs are to be replaced with %20 , but I can't imagine that would be the problem inside the actual query - especially since I've tried this already and received the same error. 据我了解,URL中的任何空格都将替换为%20 ,但我无法想象这将是实际查询中的问题-尤其是因为我已经尝试过此操作并收到了相同的错误。


Edit : My question is not about validating the PHP the src property is pointing to, but rather how the value/string is formatted for src . 编辑 :我的问题不是关于验证src属性指向的PHP,而是关于src的值/字符串格式。

You have given the validator the source code to a PHP program, when you should be giving it the HTML document you get when you run the PHP program. 您已经向验证器提供了PHP程序的源代码,而应该给它提供运行PHP程序时获得的HTML文档。

It is a markup validator, not a PHP source code validator. 它是一个标记验证器,而不是PHP源代码验证器。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM