原帖:
http://www.discuz.net/viewthread ... p;page=2#pid6566060
原作者:dzxw
在plugins\medalcenter\medalcenter.func.
php文件:
搜索:
複製內容到剪貼簿
代碼:
if(!function_exists('array_combine')) {
function array_combine($keys, $values) {
$result = array();
if(is_array($keys) && is_array($values)) {
if(count($keys) >= count($values)) {
foreach($values as $value) {
$key = $key ? next($keys) : current($keys);
$result[] = array_combine($key, $value);
}
} else {
foreach($keys as $key) {
$value = $value ? next($values) : current($values);
$result[] = array_combine($key, $value);
}
}
} elseif(!is_array($keys) && !is_array($values)) {
$keys = is_string($keys) ? '\''.addcslashes($keys, '\'\\').'\'' : $keys;
$values = (!preg_match("/^\-?[1-9]\d*$/", $values) || strlen($values) > 12) ? '\''.addcslashes($values, '\'\\').'\'' : $values;
$result = array($keys => $values);
} elseif(is_array($keys) && !is_array($values)) {
foreach($keys as $key) {
$result[] = array_combine($key, $values);
}
} elseif(!is_array($keys) && is_array($values)) {
foreach($values as $value) {
$result[] = array_combine($keys, $value);
}
}
return $result;
}
}替換成:
複製內容到剪貼簿
代碼:
if(!function_exists('array_combine')) {
function array_combine($arr_key,$arr_val){
if( !is_array($arr_key) or !is_array($arr_val)){
echo '<b>Warning</b>: array_combine() expects all parameters to be array';
return false;
}
if(count($arr_key) != count($arr_val)){
echo '<b>Warning</b>: array_combine() Both parameters should have an equal number of elements';
return false;
}
$count = count($arr_key);
for($i=0;$i<$count;$i++){
$key = $arr_key[$i];
$val = $arr_val[$i];
$arr_new[$key] = $val;
}
return $arr_new;
}
}