dongnaoxia0927 2019-06-15 20:36
浏览 56

删除未定义的索引[重复]

None of the solutions in the other threads were clear. I need help removed the undefined message. The line of code that is causing it is this variable:

$ain = $_Get['AIN'];

Other threads mentioned using upset although I could not follow. I want to be able to pass a value in whether it is null or not.

</div>
  • 写回答

2条回答 默认 最新

  • dqusbxh44823 2019-06-15 21:12
    关注

    You have to check the existence of the array index before using it, and provide an alternative value to use in case it isn't set.

    For example:

    if(isset($_GET['AIN'])){
      //The value is set and you can use it
      $ain = $_GET['AIN'];
    } else {
      //The value is not set, so you should provide a default value
      $ain = NULL;
    }
    

    Also note that the PHP language is case sensitive, so if you want to refer to HTTP GET parameters, you should use $_GET, because $_Get will not work.

    评论

报告相同问题?

悬赏问题

  • ¥15 对于这个问题的代码运行
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败