-1

有一个程序员设计的程序,但不愿意帮助设置它。尝试将代码连接到数据库时出现此错误

解析错误:语法错误,意外的“=”,在第 33 行的 \system\database\DB_driver.php 中需要 T_FUNCTION

我仔细检查了主机名、用户名、密码和数据库名称,但没有成功。

var $hostname;      = 'localhost';
var $username;      = 'pepadmin';
var $password;      = '******';
var $database;      = 'databasetest';
var $dbdriver       = 'mysql';
var $dbprefix       = '';
var $char_set       = 'utf8';
var $dbcollat       = 'utf8_general_ci';
var $autoinit       = TRUE; // Whether to automatically initialize the DB
var $swap_pre       = '';
var $port           = '';
var $pconnect       = FALSE;
var $conn_id        = FALSE;
var $result_id      = FALSE;
var $db_debug       = FALSE;
var $benchmark      = 0;
var $query_count    = 0;
var $bind_marker    = '?';
var $save_queries   = TRUE;
var $queries        = array();
var $query_times    = array();
var $data_cache     = array();
var $trans_enabled  = TRUE;
var $trans_strict   = TRUE;
var $_trans_depth   = 0;
var $_trans_status  = TRUE; // Used with transactions to determine if a rollback should occur
var $cache_on       = FALSE;
var $cachedir       = '';
var $cache_autodel  = FALSE;
var $CACHE; // The cache class object

// Private variables
var $_protect_identifiers   = TRUE;
var $_reserved_identifiers  = array('*'); // Identifiers that should NOT be escaped

// These are use with Oracle
var $stmt_id;
var $curs_id;
var $limit_used;
4

3 回答 3

3

首先,您可能不需要所有这些var声明。此外,您甚至在定义它们之前就用分号终止这些行。

var $hostname;      = 'localhost';
var $username;      = 'pepadmin';
var $password;      = '******';
var $database;      = 'databasetest';

与您的意图相比

$hostname      = 'localhost';
$username      = 'pepadmin';
$password      = '******';
$database      = 'databasetest';
于 2013-10-09T04:07:18.927 回答
0

变量后删除分号试试这个

    var $hostname      = 'localhost';
    var $username     = 'pepadmin';
    var $password     = '******';
    var $database      = 'databasetest';
于 2013-10-09T04:09:03.990 回答
0

不需要 var 并且在初始化变量之前不应该使用分号。删除标记的字符。

var$hostname ; = '本地主机';

var$用户名; = 'pepadmin';

var$密码; =' ** ';

var$database ; = '数据库测试';

于 2013-10-09T04:12:10.133 回答