标签:php
我的代码如下所示,并在我的页面(w-o-l.ml/login.php)上显示此消息
Parse error: syntax error, unexpected end of file in /home/u536535282/public_html/includes/config.php on line 36
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 '
'.$e->getMessage().'
';exit;
}
//include the user class, pass in the database connection
include('classes/user.php');
include('classes/phpmailer/mail.php');
$user = new User($db);
?>
如果有人可以指出我出了什么问题,我将不胜感激
解决方法:
看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);
标签:php
来源: https://codeday.me/bug/20191012/1902579.html