未初始化的字符串偏移量:0

时间:2016-12-26 10:37:49

标签: php codeigniter compiler-errors

加载数据库时出现此错误:

  

遇到PHP错误       严重性:注意       消息:未初始化的字符串偏移量:0       文件名:mysqli / mysqli_driver.php       行号:120       回溯:       文件:/home1/learnio3/public_html/application/controllers/Reading.php       行:9       功能:数据库

output = []
word = "pear"
with open("file.txt") as file:
    lines = file.readlines()
    for line in lines:
        if word in line:
            output.append(line)

print(output)
File: /home1/learnio3/public_html/index.php
Line: 315
Function: require_once

database.php中

public function __construct() {
    parent::__construct();
    $this->load->database();
    $this->load->helper('url');

}

1 个答案:

答案 0 :(得分:0)

更改hostname => ''到hostname => 'localhost',不要把它留空, 即使它是web服务器,cloud9等,也会传递'localhost',尽管在phpmyadmin中主机名是“%”