Php 未定义偏移量:5

Php 未定义偏移量:5,php,html,undefined,offset,Php,Html,Undefined,Offset,我知道问题出在“!=0”值附近,但无论我将其更改为什么,它要么刷新整个工作,要么重复相同的消息 你错过了在下面的语句中 Notice: Undefined offset: 5 in [file location] on line 22 Notice: Undefined offset: 6 in [file location] on line 22 Notice: Undefined offset: 7 in [file location] on line 22 Notice: Undefine

我知道问题出在“!=0”值附近,但无论我将其更改为什么,它要么刷新整个工作,要么重复相同的消息

  • 你错过了
    在下面的语句中

    Notice: Undefined offset: 5 in [file location] on line 22
    Notice: Undefined offset: 6 in [file location] on line 22
    Notice: Undefined offset: 7 in [file location] on line 22
    Notice: Undefined offset: 8 in [file location] on line 22
    Notice: Undefined offset: 9 in [file location] on line 22
    
    echo“”
    
  • 您将按5步迭代
    $i+$rows
    和您的
    $table
    最多只能运行
    $table[4]
  • 错误/通知是由于相同的原因造成的

  • 我得到了相同的错误代码,但我设法找到了问题所在。您收到的错误消息与数组有关。似乎您正在引用未定义的数组[key]:
    for($i=0;$i我想是谁发布的这个问题已经解决了。只要在这一行对($i=0;$i)稍作改动,如果你能解释一下你在做什么以及为什么它会起作用,答案就会更有用。
    
    Notice: Undefined offset: 5 in [file location] on line 22
    Notice: Undefined offset: 6 in [file location] on line 22
    Notice: Undefined offset: 7 in [file location] on line 22
    Notice: Undefined offset: 8 in [file location] on line 22
    Notice: Undefined offset: 9 in [file location] on line 22
    
    echo "</table>"
    
    <?php
    if(isset($_POST['submit'])){
        $the_file = file($_FILES['the_file']['tmp_name']);
        for( $i = 0; $i < count($myfile); ++$i){
            echo $myfile[$i] . "<br/>";
            echo "Line " . ( $i + 1 ) . " is  " .strlen($myfile[$i]) . " characters long<br/>";
        }
    }
    ?>
    
    
    <form method="post" action="myphp.php" enctype='multipart/form-data' >
        <input type="file" name="the_file" value="Yes"/>
        <input type="submit" name="submit" value="No"/>
    </form>