知道为什么第2行和第6行会抛出Notice: Uninitialized string offset: 0
?
function get_user_class() {
if ((int) $GLOBALS['CURUSER']['class'] > $GLOBALS['UC_HIGHEST_CLASS'] || (int) $GLOBALS['CURUSER']['class'] < 0) {
exit();
}
else
return $GLOBALS['CURUSER']['class'];
}
var_dump($GLOBALS['CURUSER']['class'])
给出:
string '0' (length=1)
php -v
是:
PHP 5.2.6-1+lenny13 with Suhosin-Patch 0.9.6.2