<?php
class FileUpLoad{private $error;//錯誤代碼
public function __construct($_file){
$this->error=$_FILES[$_file][error];
echo $this->error;
}
}
?>
因爲error 沒有加上單引號 當打印出來的時候會提示
報錯:Notice: Use of undefined constant error - assumed 'error' in C:\wamp\www\yianshujuku\common\FileUpload.class.php on line 6,最好加上單引號
即下面所示:
<?php
class FileUpLoad{private $error;//錯誤代碼
public function __construct($_file){
$this->error=$_FILES[$_file][‘error’];
echo $this->error;
}
}
?>