如何去掉ajax图片上传提示

发布于 2024-12-23 02:35:26 字数 304 浏览 5 评论 0原文

我正在 php 中做项目。我使用 ajax 代码上传图像。 它做得很好,一切正常,但显示通知,我想 2 删除此通知...... 注意如下:

  • 注意:未定义变量:errorList in C:\xampp\htdocs\ajax\scripts\ajaxupload.php on line 18 注意: 未定义的变量:errorList 中 C:\xampp\htdocs\ajax\scripts\ajaxupload.php on line 132

我不明白消息的含义是什么... 如何删除该通知?

I am doing project in php.I used ajax code to upload the image.
It done nicely, everything is working but display notice and i want 2 remove this notice...
Notice is as follows:

  • Notice: Undefined variable: errorList in C:\xampp\htdocs\ajax\scripts\ajaxupload.php on line 18 Notice:
    Undefined variable: errorList in
    C:\xampp\htdocs\ajax\scripts\ajaxupload.php on line 132

i am not understanding what is the meaning of message...
How to remove this Notice?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

书间行客 2024-12-30 02:35:26

要删除该通知,您必须检查此变量 $errorList 是否已定义,如果是,则检查第 18 行的 ajaxupload.phpajaxupload.php 在线132 它是否在那里看到它或者它超出了范围。

您可以做的另一件事是放在 PHP 文件 ini_set( 'display_errors', 0 ); 的开头,但这确实是个坏主意,因为 Notice 是用来显示什么的你做错了。

To remove the notice you must either check is this variable $errorList defined and if it is, then check ajaxupload.php on line 18 and ajaxupload.php on line 132 does it see it there or is it out of the scope.

The other thing you could do is place at the beginning of PHP file ini_set( 'display_errors', 0 );, but this really bad idea since Notice is made to show what you are doing wrong.

眼眸印温柔 2024-12-30 02:35:26

只需在使用变量之前将它们定义为 null,这样默认情况下它们就为 null,直到从其他地方给定值为止。在 if 块内或通过用户输入定义的变量有时不会被定义,对吧?因此,对于它们来说,需要一个默认值,这样即使没有给它们赋予值,它们至少也存在。

$errorList = null;

Simply define the variables as null before using them, so that by default they will be null until given a value from elsewhere. Variables defined inside an if block or by user input sometimes don't get defined, right? So for them, a default is needed sso that they at least exist even if they aren't given a value.

$errorList = null;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文