Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何W3C验证php图像大小调整脚本_Html_W3c Validation - Fatal编程技术网

Html 如何W3C验证php图像大小调整脚本

Html 如何W3C验证php图像大小调整脚本,html,w3c-validation,Html,W3c Validation,我使用一个php图像调整脚本,该脚本通过以下方式调用: <img src="/images/image.php?img=test.png&maxw=100&maxh=100" alt="This is a test image" /> 但这并不是W3C验证的。有什么方法可以验证这个吗?它与PHP无关。您只需将这些&字符转换为实体: <img src="/images/image.php?img=test.png&amp;maxw=100&a

我使用一个php图像调整脚本,该脚本通过以下方式调用:

<img src="/images/image.php?img=test.png&maxw=100&maxh=100" alt="This is a test image" />


但这并不是W3C验证的。有什么方法可以验证这个吗?

它与PHP无关。您只需将这些
&
字符转换为实体:

<img src="/images/image.php?img=test.png&amp;maxw=100&amp;maxh=100" alt="This is a test image" />


真的,这没什么大不了的。没有浏览器(我知道)会误解这一点,但如果你想要完美的验证,那么这就是你需要做的。

由于你没有给出确切的eror消息,我不得不假设验证失败是因为符号。只要看一看(wich也应该直接链接到验证报告,这样您就可以很容易地自己找到它),看看如何解决这个问题

为避免验证程序和浏览器出现问题,请始终使用& 在HTML中编写URL时替代&

也就是说,只需将代码更改为:

... src="/images/image.php?img=test.png&amp;maxw=100&amp;maxh=100" ...

如果您从PHP输出此类URL,您可以使用它自动将
&
转换为
&

htmlentities-将所有适用字符转换为HTML实体

示例:

$path = "/images/image.php?img=test.png&maxw=100&maxh=100";
$path = htmlentities($path);
echo $path;
这将在html中输出:

/images/image.php?img=test.png&amp;maxw=100&amp;maxh=100

W3C验证程序中的错误是什么?