简体   繁体   中英

Fatal error: Cannot use string offset as an array in meta.php on line 43

Fatal error: Cannot use string offset as an array in /home/content/51/6183951/html/triadss/wp-content/themes/smartbox-installable/lib/functions/meta.php on line 43

Kindly solve this issue!!!!

meta.php on line 43 starts with " array_push "

function get_des_templates($type)
{
    global $wpdb;
    $q = "SELECT * from ".$wpdb->prefix."options WHERE option_name LIKE 'des_template_[$type]_%'";
    $res = $wpdb->get_results($q, ARRAY_A);
    $output = array();
    foreach($res as $r)
    {
        $options = unserialize(trim($r['option_value']));
        if (is_string($options))
        {
            $options = unserialize($options);
        }
        array_push($output, array("id"=>$options['des_template_tab']['name'], "name"=>$options['des_template_tab']['nicename']));
    }
    return $output;
}

second argument to array_push should be single item (string).

Please check link .

Try using array_merge

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM