4
我在CakePHP中得到了下面的错误,该函数在PHP中正常工作而不是Cake,有没有人知道为什么这不被支持或解决方法?CakePHP不支持的操作数
Error: Unsupported operand types
File: /var/www/spitdev/console2/app/Lib/IpLib.php
Line: 40
Notice: If you want to customize this error message, create app/View/Errors/fatal_error.ctp
功能:
public function lastHost($ip_add, $subnet_mask){
$ip = ip2long($ip_add);
$nm = ip2long($subnet_mask);
$nw = ($ip & $nm);
$bc = $nw | (~$nm); <------------LINE 40
$lh = long2ip($bc - 1);
return $lh;
}
我高度怀疑,这是CakePHP的具体
返回相同的错误。它看起来像一个基本的PHP问题。 – mark
'$ submet_mask'很可能无效,ip2long返回false。然后按位“〜”运算符是抛出错误的东西。 – tigrang
检查任何空的数据是在$ nm和$ nw中出现的。我遇到了这种类型的问题。 – Shaddy