我的代码看起来像这样,在我的页面(w-o-l.ml/login.php)上显示此消息
解析错误:语法错误,第36行/home/u536535282/public_html/includes/config.php中的文件意外结束
<?php
ob_start();
session_start();
//set timezone
date_default_timezone_set('America/New_York');
//database credentials
define('DBHOST','mysql.hostinger.co.uk');
define('DBUSER','u536535282_evan7');
define('DBPASS','anaavcnM9t7');
define('DBNAME','u536535282_dbsql');
//application address
define('DIR','http://w-o-l.ml/');
define('SITEEMAIL','it@w-o-l.ml');
try {
//create PDO connection
$db = new PDO("mysql:host=".DBHOST.";port=8889;dbname=".DBNAME, DBUSER, DBPASS.");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
//show error
echo '<p>'.$e->getMessage().'</p>';
exit;
}
//include the user class, pass in the database connection
include('classes/user.php');
include('classes/phpmailer/mail.php');
$user = new User($db);
?>
<小时/> 如果有人能指出我的错误,我会很感激
答案 0 :(得分:1)
看看SO如何解析你的代码,我会说
$db = new PDO("mysql:host=".DBHOST.";port=8889;dbname=".DBNAME, DBUSER, DBPASS.");
应该是
$db = new PDO("mysql:host=".DBHOST.";port=8889;dbname=".DBNAME, DBUSER, DBPASS);