在PHP类中包含外部文件的变量,以便在Adobe / Apache Flex服务中使用

Basically what I am trying to do is relocate the database access variables (username, password, etc) to an external php file then include that file in the services. So, here's my service code that I though would work:

<?php
/** Database Access Information */
class LoginService {
    require 'parameters.php';

var $accesstable = "access";
var $lastlogintable = "last_login";
var $loginhistorytable = "login_history";

var $connection;

/** The constructor initializes the connection to database. */

public function __construct() {
    $this->connection = mysqli_connect(
                            $this->server,  
                            $this->username,  
                            $this->password, 
                            $this->databasename,
                            $this->port
                        );

    $this->throwExceptionOnError($this->connection);
}

Then here is the code I thought would work in the external file:

<?php

var $username = "root";
var $password = "";
var $server = "localhost";
var $port = "3306";
var $databasename = "User";

?>

But, alas, it no worky... Dreamweaver keeps giving me a syntax error on the line:

require 'parameters.php';

Put require inside a method - class syntax does not permit any code inside class body (but you can include anything in method body).

public function __construct() {
    require 'parameters.php'; 
    $this->connection = mysqli_connect(
                        $this->server,  
                        $this->username,  
                        $this->password, 
                        $this->databasename,
                        $this->port
                    );

        $this->throwExceptionOnError($this->connection);
}