php传递函数并将值返回给调用函数

赫曼特

这里有两个参数imgdir传递给img_upld函数。如何rslt['data']在调用函数中使用img_upld准确地说,首先我上传图片,如果图片上传成功,然后想要运行插入查询以避免重复的图片上传代码。

$this->img_upld($img, $dest);

我试过

if($this->img_upld($img,$dest)){
    $data = $this->img_upld(); // obviously it says few arguments
    echo $data['status'];   
}



public function img_upld($img, $dir){
        $handle = new file_upld('data:'.$img);
        if($handle->uploaded){
            ...
            if($handle->processed){
                $rslt['status'] = 'success';
                $rslt['data'] = $handle->file_new_name_body;

            }
        }
}
马纳什·库马尔
$data = $this->img_upld($img,$dest);
if($data){
    echo $data['status'];   
}



public function img_upld($img, $dir){
        $handle = new file_upld('data:'.$img);
        if($handle->uploaded){
            ...
            if($handle->processed){
                $rslt['status'] = 'success';
                $rslt['data'] = $handle->file_new_name_body;

            }
        }
        return $rslt;
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章