数据库连接.php
<?php
class DB_Connect {
private $conn;
public function connect()
{
require_once 'config.php';
$this->conn = new mysqli_connect(host:DB_HOST,username:DB_USER,passwd:DB_PASSWORD,dbname:DB_DATABASE);
return $this->conn;
}
}
?>
配置.php
<?php
define(DB_HOST, "localhost");
define(DB_USER, "root");
define(DB_PASSWORD, "");
define(DB_DATABASE, "bluepeatshop");
?>
错误是:
Parse error: syntax error, unexpected ':' in C:\wamp64\www\bluepeatshop\db_connect.php
on line 9
1条答案
按热度按时间yduiuuwa1#
您的固定用法不正确,请尝试按以下方式更改您的db connect字符串,