javascript - 如何读取和修复 * 未初始化 * 变量的控制台消息
问题描述
我正在开发一个读取 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);```
解决方案
推荐阅读
- intersystems-cache - 运行 $COMPILE 目标代码而不将其保存到全局优先
- angular - 是否可以在一次登录下组合多个 Angular 应用程序?
- typescript - 如何在 Typescript 中使用 jsdoc 类型?
- vue.js - 从路由器链接发出事件
- awk - 如何使用 awk 将文本文件汇总为新文件
- python - Python,正则表达式 - 从字典中的字符串中检索关键字
- apache-spark - 使用 ES-Spark 连接器创建嵌套对象数组
- c++ - C++中指针大小的保证
- oracle - Oracle REST API 字典
- python - 使用 Pandas 将列从一个数据帧添加到另一个具有不同列名的数据帧