我在Codeigniter中收到了这些错误.
Run Code Online (Sandbox Code Playgroud)Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() inC:\ xampp1\htdocs\CI\system\database\drivers\mysql\mysql_driver.php:92堆栈跟踪:#0 C:\ xampp1\htdocs\CI\system\database\DB_driver.php(116):CI_DB_mysql_driver-> db_pconnect()#1 C:\ xampp1\htdocs\CI\system\database\DB.php(149):CI_DB_driver-> initialize()#2 C:\ xampp1\htdocs\CI\system\core\Loader.php( 347):DB(Array,NULL)#3 C:\ xampp1\htdocs\CI\application\models\usermodel.php(7):CI_Loader-> database()#4 C:\ xampp1\htdocs\CI\application\controllers\userscontroller.php(9):UserModel-> getUser()#5 C:\ xampp1\htdocs\CI\system\core\CodeIgniter.php(360):UsersController-> index()#6 C:\ xampp1\htdocs\CI\index.php(202):require_once('C:\ xampp1\htdoc ...')#7 {main}抛出C:\ xampp1\htdocs\CI\system\database\drivers\mysql\mysql_driver第92行的.php
模型类
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class UserModel extends CI_Model
{
public function getUser()
{
$this->load->database();
$query = $this->db->query("SELECT * from user_accounts");
return $query->result();
}
}
Run Code Online (Sandbox Code Playgroud)
查看课程
<!DOCTYPE html>
<html>
<head>
<title>User Accounts</title>
</head>
<body>
<?php foreach($users as …Run Code Online (Sandbox Code Playgroud)