有没有人知道这些PHP代码是什么导致apache2 webserver与nginx抛出服务器错误500?
function cycleColsDbl() {
static $cols = ['transparent;', '#efefef;'], $i = 0;
$selectCol = ($i++/2 % 2 == 0) ? 0 : 1;
return $cols['$selectCol'];
}
服务器suexec.log吐出了一个相当荒谬的说法:
[2016-04-17 08:34:34]: uid: (10003/usr) gid: (1003/1003) cmd: cgi_wrapper
而且error.log根本没有说明这一点。
在页面加载时抛出500,因此函数永远不会被调用。
想点什么?
答案 0 :(得分:1)
此$cols['$selectCol'];
会查找密钥$selectCol
,而不是0
或1
。如果您没有将其设为文字,则会查找0
或1
,即删除单引号。
另外,static $cols = ['transparent;', '#efefef;']
不是在PHP中创建数组的正确语法。
function cycleColsDbl() {
static $cols = array('transparent;', '#efefef;'), $i = 0;
$selectCol = ($i++/2 % 2 == 0) ? 0 : 1;
return $cols[$selectCol];
}