Php 上载excel文件时显示错误消息“缺少参数”
我有一个php类,它处理word、excel和power point文件,并在加载页面后显示其数据。它完美地显示了word文档数据,但当我使用excel文件$docObj=new DocxConversiontest.xlsx;然后显示以下错误消息: 我不明白为什么我会收到这些错误消息。有人能告诉我吗Php 上载excel文件时显示错误消息“缺少参数”,php,Php,我有一个php类,它处理word、excel和power point文件,并在加载页面后显示其数据。它完美地显示了word文档数据,但当我使用excel文件$docObj=new DocxConversiontest.xlsx;然后显示以下错误消息: 我不明白为什么我会收到这些错误消息。有人能告诉我吗 Warning: Missing argument 1 for DocxConversion::xlsx_to_text(), called in D:\Software Installed\x
Warning: Missing argument 1 for DocxConversion::xlsx_to_text(), called in D:\Software
Installed\xampp\htdocs\evan\toplevel\file.php on line 116 and defined in D:\Software
Installed\xampp\htdocs\evan\toplevel\file.php on line 58
Notice: Undefined variable: input_file in D:\Software Installed\xampp\htdocs
\evan\toplevel\file.php on line 62
Warning: ZipArchive::open(): Empty string as source in D:\Software Installed\xampp
\htdocs\evan\toplevel\file.php on line 62
Php类文件
这里有一个函数:
function xlsx_to_text($input_file){
...
if(true === $zip_handle->open($input_file)){
...
}else{
...
}
return $output_text;
}
您在convertToText函数中按如下方式调用上述函数:
} elseif($file_ext == "xlsx") {
return $this->xlsx_to_text();
}
xlsx_to_text$input_file函数需要一个参数,但在调用时没有传递一个参数。我不认为您编写类的方式是缩进来传递任何参数。我假设您希望在初始化时设置$filename属性的对象上调用该函数。因此,我认为您可以将xlsx_更新为_text$input_file函数,如下所示:
function xlsx_to_text(){ // <---------------- Change here.
...
if(true === $zip_handle->open($this->filename)){ // <---------------- Change here.
...
}else{
...
}
return $output_text;
}
同样,函数pptx_to_text$input_file{function.也可以发布evan\toplevel\file.php文件吗?这个php类文件名是file.php,这是一个很棒的答案!!
} elseif($file_ext == "xlsx") {
return $this->xlsx_to_text();
}
function xlsx_to_text(){ // <---------------- Change here.
...
if(true === $zip_handle->open($this->filename)){ // <---------------- Change here.
...
}else{
...
}
return $output_text;
}