小编Ste*_*ven的帖子

连接到MYSQL时出错

这是config.php文件

<?php

error_reporting(E_ALL ^ E_NOTICE);

/*=========== Database Configuraiton ==========*/

$db_host = "localhost";
$db_user = "test";
$db_pass = "test";
$db_name = "dbtest";


/*=========== Website Configuration ==========*/

$defaultTitle = 'testing';
$defaultFooter = date('Y').' &copy; testing';

?>
Run Code Online (Sandbox Code Playgroud)

这是对config.php的引用

<?php


require_once "includes/config.php";
require_once "includes/connect.php";
require_once "includes/helpers.php";



header('Cache-Control: max-age=3600, public');
header('Pragma: cache');
header("Last-Modified: ".gmdate("D, d M Y H:i:s",time())." GMT");
header("Expires: ".gmdate("D, d M Y H:i:s",time()+3600)." GMT");

?>
Run Code Online (Sandbox Code Playgroud)

Connect.php如下

<?php

/*
        The login details are taken from config.php.
*/

try {
    $db = new PDO(
        "mysql:host=$db_host;dbname=$db_name;charset=UTF-8", …
Run Code Online (Sandbox Code Playgroud)

php mysql connection

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

connection ×1

mysql ×1

php ×1