Apacher php-fpm linux 下 日志出现Cannot use a scalar value as an array 错误警告
执行错误警告行:
$notValveForKey[$key]='app='.APP_NAME.'&mod='.MODULE_NAME.'&act='.ACTION_NAME;
以下是完整方法:
function L($key,$data = array()){
$key = strtoupper($key);
if(!isset($GLOBALS['_lang'][$key])){
$notValveForKey = F('notValveForKey', '', DATA_PATH.'/develop');
if($notValveForKey==false){
$notValveForKey = array();
}
if(!isset($notValveForKey[$key])){
*$notValveForKey[$key] = '?app='.APP_NAME.'&mod='.MODULE_NAME.'&act='.ACTION_NAME;*
}
F('notValveForKey', $notValveForKey, DATA_PATH.'/develop');
return $key;
}
if(empty($data)){
return $GLOBALS['_lang'][$key];
}
$replace = array_keys($data);
foreach($replace as &$v){
$v = "{".$v."}";
}
return str_replace($replace,$data,$GLOBALS['_lang'][$key]);
}
希望大神帮助。
在报错行前,打印$notValveForKey的值,就知道问题了