我班上有这个
当调用第二个函数时,php 错误数据类型错误,并且只能通过引用传递变量。
我不知道他们是什么意思
这段代码来自 php.net 如果相同的代码在类之外它执行得很好
如果我在课堂上工作,我在这里做错了什么?
$extensiesAllowed= array();
function __construct() {
$this->extensiesAllowed= array("txt", "pdf");
$this->fileName= $_FILES['file'];
}
private function isAllowedExtensie($fileName) {
return in_array(end(explode(".", $fileName)), $this->extensiesAllowed);
}
public function check_upload() {
if($this->fileName['error'] == UPLOAD_ERR_OK) {
if(isAllowedExtensie($this->fileName['name'])) {
return true;
}
}
}
php错误显示
Array
(
[bestandsNaam] => ACCOUNT INFO.txt
[extensiesAllowed] =>
)
谢谢,理查德