Php 代码错误数字问题

Php 代码错误数字问题,php,Php,我有一个头像上传插件为我的网站,我看到这个代码错误的前端页面 警告:在上的/xxx/xxx/xxx/media.php中遇到非数字值 第647行 第647行抛出错误的代码是: $matched = ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 ); // If the image dimens

我有一个头像上传插件为我的网站,我看到这个代码错误的前端页面

警告:在上的/xxx/xxx/xxx/media.php中遇到非数字值 第647行

第647行抛出错误的代码是:

$matched = ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 );
// If the image dimensions are within 1px of the expected size, we consider it a match.
$matched = ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 );

$matched=(abs($constrated\u size[0]-$expected\u size[0])尝试检查变量我认为您使用字符串作为整数。您可以插入日志或文件内容来检查所有变量数据($constrated\u size和$expected\u size)
如果你确定你的变量是整数,那么试着把它们转换成整数,或者把它们算作字符串

使用-->(int)$constrated\u size和(int)$expected\u size

这段代码为我解决了这个问题

// If the image dimensions are within 1px of the expected size, we consider it a match.
    $matched = ( abs( (int)$constrained_size[0] - (int)$expected_size[0] ) <= 1 && abs( (int)$constrained_size[1] - (int)$expected_size[1] ) <= 1 );
<代码> / /如果图像尺寸在预期大小的1px以内,我们认为它是匹配的。
$matched=(abs((int)$constrated\u size[0]-(int)$expected\u size[0])tldr..遇到一个非数值-检查您的VAR是否有非数值..问题详细信息不足。无法再现。离题:为什么我的代码不起作用。请删除javascript标记不要声明一次性使用变量。@mickmackusa我该怎么做抱歉,我是一个新手,如果您认为你的手臂上有一个食肉性溃疡,你的医生说,“来,穿上这件长袖衬衫——你永远都看不到它。”你再也不会去看医生了……假设你活下来了。对有缺陷的值进行重击可能会损坏数据并提供不准确的结果。请删除此帖子,因为它提供了考虑不周的建议,并降低了StackOverflow的预期质量水平。此外,请不要回答关于StackOverflow的不清楚/不完整的答案。