Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 致命错误:调用未定义的方法UploadHandler_Php - Fatal编程技术网

Php 致命错误:调用未定义的方法UploadHandler

Php 致命错误:调用未定义的方法UploadHandler,php,Php,我正在使用,我只将UploadHandler()类的位置从HOME/server/php/UploadHandler.php更改为HOME/index.php,但我收到了以下错误: index.php:1438: Fatal Error: Call to undefined method UploadHandler::get_file_object [array_map] My index.php: <?php error_reporting(E_ALL | E_STRICT); c

我正在使用,我只将
UploadHandler()
类的位置从
HOME/server/php/UploadHandler.php
更改为
HOME/index.php
,但我收到了以下错误:

index.php:1438: Fatal Error: Call to undefined method UploadHandler::get_file_object [array_map]
My index.php:

<?php

error_reporting(E_ALL | E_STRICT);

class UploadHandler
{
    protected $options;

    // PHP File Upload error message codes:
    // http://php.net/manual/en/features.file-upload.errors.php
    protected $error_messages = array(

    etc....

    protected function get_file_object($file_name) {
        if ($this->is_valid_file_object($file_name)) {
            $file = new stdClass();
            $file->name = $file_name;
            $file->size = $this->get_file_size(
                $this->get_upload_path($file_name)
            );
            $file->url = $this->get_download_url($file->name);
            foreach($this->options['image_versions'] as $version => $options) {
                if (!empty($version)) {
                    if (is_file($this->get_upload_path($file_name, $version))) {
                        $file->{$version.'Url'} = $this->get_download_url(
                            $file->name,
                            $version
                        );
                    }
                }
            }
            $this->set_additional_file_properties($file);
            return $file;
        }
        return null;
    }

    etc...

    protected function get_file_objects($iteration_method = 'get_file_object') {
        $upload_dir = $this->get_upload_path();
        if (!is_dir($upload_dir)) {
            return array();
        }
        return array_values(array_filter(array_map(
            array($this, $iteration_method),
            scandir($upload_dir)
        )));
    }

}

$upload_handler = new UploadHandler();

?>
将此函数设置为“静态”

作为


非常感谢你!现在我没有任何错误。。但是上传不正确!我在我的页面底部得到了这个代码:
{“文件”:[]}
哪个应该是这个输入
您为表单添加了
enctype
了吗?
protected function get_file_object($file_name) {
protected static function get_file_object($file_name) {