简体   繁体   中英

Uninitialized string offset: 0

I got this error when I load database:

A PHP Error was encountered Severity: Notice Message: Uninitialized string offset: 0 Filename: mysqli/mysqli_driver.php Line Number: 120 Backtrace: File: /home1/learnio3/public_html/application/controllers/Reading.php Line: 9 Function: database

 File: /home1/learnio3/public_html/index.php Line: 315 Function: require_once 
public function __construct() {
    parent::__construct();
    $this->load->database();
    $this->load->helper('url');

}

database.php

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
    'dsn'   => '',
    'hostname' => '',
    'username' => 'learnio3_bram',
    'password' => 'xxxxxxx',
    'database' => 'learnio3_book',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

将hostname =>''更改为hostname =>'localhost',不要将其保留为空白,即使它是webserver,cloud9等,也要传递'localhost',尽管在phpmyadmin中主机名是“%”

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