简体   繁体   中英

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.

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.


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 .

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.

It is a markup validator, not a PHP source code validator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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