簡體   English   中英

致命錯誤:無法在第43行的meta.php中將字符串偏移量用作數組

[英]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

請解決這個問題!!!

第43行的meta.php以“ 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;
}

array_push的第二個參數應為單個項目(字符串)。

請檢查鏈接

嘗試使用array_merge

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM