我recieveing以下分析錯誤:解析錯誤:語法錯誤,意想不到的「(」,期望「」或‘;’在
Parse error: syntax error, unexpected '(', expecting ',' or ';' in H:\Programs\USBWebserver v8.5\8.5\root\oopforum\func\register.class.php on line 7
其涉及下面的行的在我的類代碼:
private $random_name = rand(1000,9999).rand(1000,9999).rand(1000,9999).rand(1000,9999);
我不明白爲什麼這行代碼會導致一個解析錯誤
下面是一些周邊代碼:
class register{
public $post_data = array();
private $dbh;
private $allowed_type = array('image/jpeg','image/png','image/gif');
private $random_name = rand(1000,9999).rand(1000,9999).rand(1000,9999).rand(1000,9999);
private $path = 'img/thumb_/'.$random_name. $_FILES['file']['name'];
private $max_width = 4040;
private $max_height = 4040;
private $max_size = 5242880;
private $temp_dir = $_FILES['file']['tmp_name'];
private $image_type = $_FILES['file']['type'];
private $image_size = $_FILES['file']['size'];
private $image_name = $_FILES['file']['name'];
private $image_dimensions = getimagesize($temp_dir);
private $image_width = $image_dimensions[0]; // Image width
private $image_height = $image_dimensions[1]; // Image height
private $error = array();
public function __construct($post_data, PDO $dbh){
$this->post_data = array_map('trim', $post_data);
$this->dbh = $dbh;
}
}
什麼導致瞭解析錯誤?
+1打我吧 – Jacco
謝謝..我刪除了一切,除了行設置$ random_name變量,並將其放置在__construct(),它給了我這個錯誤'解析錯誤:語法錯誤,意外的T_PRIVATE在H:\ Programs \ USBWebserver v8.5 \ 8.5 \ root \ oopforum \ func \ register.class.php on line 14' – crm
你必須用完整的類更新你的問題來確定錯誤,因爲它可能與你的前一個。 – nickb