我正在开发一个读取csv文件并生成报告的应用程序。它工作正常。但是,当我在Eclipse IDE中运行应用程序时,在控制台上会看到消息,我不确定这是否是问题。
我试图使用isset
来修复uninitialized
变量和函数,但是并没有解决我的问题。我的问题是:我应该担心这些消息吗?如果可以,我该如何解决?如果我尝试在Unix服务器上运行我的应用程序,会出现问题吗?我很难解释这些信息。
[Wed May 1 09:03:30 2019] PHP Stack trace:
[Wed May 1 09:03:30 2019] PHP 1. {main}() C:\Users\jj-localadmin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\ReportApplication4.3\index.php:0
[Wed May 1 09:03:30 2019] PHP 2. require_once() C:\Users\jj-localadmin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\ReportApplication4.3\index.php:14
[Wed May 1 09:03:30 2019] PHP 3. create_xlsx() C:\Users\jj-localadmin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\ReportApplication4.3\controller\upload.php:38
[Wed May 1 09:03:30 2019] PHP 4. require_once() C:\Users\jj-localadmin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\ReportApplication4.3\controller\upload.php:60
[Wed May 1 09:03:30 2019] PHP 5. createStatisticsReport($file = *uninitialized*) C:\Users\jj-localadmin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\ExcelReportApplication4.3\model\xlsxGenerator.php:26
[Wed May 1 09:03:30 2019] PHP 6. usort(*uninitialized*, *uninitialized*) C:\Users\jj-localadmin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\ReportApplication4.3\model\xlsxGenerator.php:187
[Wed May 1 09:03:30 2019] PHP 7. cmp($a = *uninitialized*, $b = *uninitialized*) C:\Users\jj-localadmin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\ReportApplication4.3\model\xlsxGenerator.php:187
[Wed May 1 09:03:30 2019] PHP Notice: Undefined index: First Name in C:\Users\jj-localadmin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\ReportApplication4.3\model\readStatisticsFile.php on line 102
[Wed May 1 09:03:30 2019] PHP Stack trace:
在5中,我正在检查变量是否为空,但仍会给出错误。
错误:
[Wed May 1 09:03:30 2019] PHP 5. createStatisticsReport($file = *uninitialized*) C:\Users\jj-localadmin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\ExcelReportApplication4.3\model\xlsxGenerator.php:26
我的代码:
$fileName = 'data/uploadFile.csv'; // path for the csv file (registration and user statistics file are upload with the name)
if ($answer == "Statistics") {
require_once 'readStatisticsFile.php';
if (validateStatsFile($fileName) == 'true' && !empty($fileName))
createStatisticsReport($fileName);```