我收到这个错误“警告:非法的字符串偏移”类型在/home/mysite/public_html/wp-content/themes/evento/lib/php/extra.class.php第32行“
而且我意识到文件中的这段代码是错误的,但是我并没有那么好的PHP,而且我想知道有人可以帮我重写这个部分以消除错误.谢谢! (错误从第32行开始,这是if语句的开头)
这是代码:
/* new version */
function get_attachment_struct( $inputs ){
$attach = array();
if( $inputs['type'] == 'attach' ){
$name = $inputs['name'];
$attach = array(
0 => array(
'name' => $name,
'type' => 'text',
'label' => 'Attachment URL',
'lvisible' => false,
'upload' => true,
),
1 => array(
'name' => $name .'_id',
'type' => 'hidden',
'upload' => true
),
);
if( isset( $inputs[ 'classes' ] ) ){
$attach[0]['classes'] = $inputs[ 'classes' ];
$attach[1]['classes'] = $inputs[ 'classes' ] . '_id';
}
}
return $attach;
}
/* new version */