嘗試執行php文件時,在本地MAMP服務器上獲取HTTP錯誤500。MAMP:來自PHP文件的HTTP錯誤500
所有我的其他網頁將運行,但這一個不會,所以我想這可能是與PHP的設置?
<?php
// User.class.php
require_once 'DB.class.php';
class User {
public $id;
public $username;
public $hashedPassword;
public $email;
public $joinDate;
// Takes an associative array with the DB row as an argument.
function __construct($data) {
$this->id = (isset($data['id'])) ? $data['id'] : "";
$this->username = (isset($data['username'])) ? $data['username'] : "";
$this->hashedPassword = (isset($data['password'])) ? $data['password'] : "";
$this->email = (isset($data['email'])) ? $data['email'] : "";
$this->joinDate = (isset($data['join_date'])) ? $data['join_date'] : "";
}
public function save($isNewUser = false) {
$db = new DB();
// Update already registered user.
if (!$isNewUser) {
$data = array(
"username" => "'$this->username'";
"password" => "'$this->hashedPassword'";
"email" => "'$this->email'";
);
$db->update($data, 'users', 'id = '.$this->id);
}
// Register new user.
else {
$data = array(
"username" => "'$this->username'";
"password" => "'$this->hashedPassword'";
"email" => "'$this->email'";
"join_date" => "'".date("Y-m-d H:i:s", time())."'"
);
$this->id = $db->insert($data, 'users');
$this->joinDate = time();
}
return true;
}
}
?>
PHP錯誤日誌:
[13-May-2011 23:58:28] PHP Parse error: syntax error, unexpected ';', expecting ')' in /Applications/MAMP/htdocs/Project/classes/User.class.php on line 35
它說你的Apache error.log是500錯誤的原因是什麼?如果你不明白它告訴你什麼,請把它粘貼到你原來的問題中...... – 2011-05-13 23:12:14