Maison >développement back-end >tutoriel php >scalar PHP警告Cannot use a scalar value as an array的解决方法
看到php的错误日志里有些这样的提示:
[27-Aug-2011 22:26:12] PHP Warning: Cannot use a scalar value as an array in /www/hx/enjoy.php on line 14
[27-Aug-2011 22:26:18] PHP Warning: Cannot use a scalar value as an array in /www/hx/enjoy.php on line 14
检查源程序,大概是下面这样子:
复制代码 代码如下:
$arr_hx = $mem->get('hx');
if(!$arr_hx) {
$arr_hx[‘a'] = 'b';
$mem->set('hx',$arr_hx);
}
以上就介绍了scalar PHP警告Cannot use a scalar value as an array的解决方法,包括了scalar方面的内容,希望对PHP教程有兴趣的朋友有所帮助。