久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <bdo id='ul8pn'></bdo><ul id='ul8pn'></ul>

    1. <i id='ul8pn'><tr id='ul8pn'><dt id='ul8pn'><q id='ul8pn'><span id='ul8pn'><b id='ul8pn'><form id='ul8pn'><ins id='ul8pn'></ins><ul id='ul8pn'></ul><sub id='ul8pn'></sub></form><legend id='ul8pn'></legend><bdo id='ul8pn'><pre id='ul8pn'><center id='ul8pn'></center></pre></bdo></b><th id='ul8pn'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ul8pn'><tfoot id='ul8pn'></tfoot><dl id='ul8pn'><fieldset id='ul8pn'></fieldset></dl></div>

      1. <legend id='ul8pn'><style id='ul8pn'><dir id='ul8pn'><q id='ul8pn'></q></dir></style></legend><tfoot id='ul8pn'></tfoot>

        <small id='ul8pn'></small><noframes id='ul8pn'>

        PHP 注意:未定義偏移量:1 讀取數據時帶數組

        PHP Notice: Undefined offset: 1 with array when reading data(PHP 注意:未定義偏移量:1 讀取數據時帶數組)
            <tbody id='ST1ev'></tbody>

              <small id='ST1ev'></small><noframes id='ST1ev'>

              <tfoot id='ST1ev'></tfoot>

              <i id='ST1ev'><tr id='ST1ev'><dt id='ST1ev'><q id='ST1ev'><span id='ST1ev'><b id='ST1ev'><form id='ST1ev'><ins id='ST1ev'></ins><ul id='ST1ev'></ul><sub id='ST1ev'></sub></form><legend id='ST1ev'></legend><bdo id='ST1ev'><pre id='ST1ev'><center id='ST1ev'></center></pre></bdo></b><th id='ST1ev'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ST1ev'><tfoot id='ST1ev'></tfoot><dl id='ST1ev'><fieldset id='ST1ev'></fieldset></dl></div>
              • <bdo id='ST1ev'></bdo><ul id='ST1ev'></ul>

              • <legend id='ST1ev'><style id='ST1ev'><dir id='ST1ev'><q id='ST1ev'></q></dir></style></legend>
                  本文介紹了PHP 注意:未定義偏移量:1 讀取數據時帶數組的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我收到此 PHP 錯誤:

                  I am getting this PHP error:

                  PHP Notice:  Undefined offset: 1
                  

                  這是拋出它的 PHP 代碼:

                  Here is the PHP code that throws it:

                  $file_handle = fopen($path."/Summary/data.txt","r"); //open text file
                  $data = array(); // create new array map
                  
                  while (!feof($file_handle) ) {
                      $line_of_text = fgets($file_handle); // read in each line
                      $parts = array_map('trim', explode(':', $line_of_text, 2)); 
                      // separates line_of_text by ':' trim strings for extra space
                      $data[$parts[0]] = $parts[1]; 
                      // map the resulting parts into array 
                      //$results('NAME_BEFORE_:') = VALUE_AFTER_:
                  }
                  

                  這個錯誤是什么意思?導致此錯誤的原因是什么?

                  What does this error mean? What causes this error?

                  推薦答案

                  更改

                  $data[$parts[0]] = $parts[1];
                  

                  if ( ! isset($parts[1])) {
                     $parts[1] = null;
                  }
                  
                  $data[$parts[0]] = $parts[1];
                  

                  或者簡單地說:

                  $data[$parts[0]] = isset($parts[1]) ? $parts[1] : null;
                  

                  并非文件的每一行都有一個冒號,因此在它上面爆炸會返回一個大小為 1 的數組.

                  Not every line of your file has a colon in it and therefore explode on it returns an array of size 1.

                  根據php.net 可能從explode返回值:

                  返回通過在分隔符形成的邊界上拆分字符串參數而創建的字符串數組.

                  Returns an array of strings created by splitting the string parameter on boundaries formed by the delimiter.

                  如果分隔符是一個空字符串 (""),explode() 將返回 FALSE.如果分隔符包含字符串中不包含的值并且使用負限制,則返回空數組,否則返回包含字符串的數組.

                  If delimiter is an empty string (""), explode() will return FALSE. If delimiter contains a value that is not contained in string and a negative limit is used, then an empty array will be returned, otherwise an array containing string will be returned.

                  這篇關于PHP 注意:未定義偏移量:1 讀取數據時帶數組的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)
                    <i id='gO79p'><tr id='gO79p'><dt id='gO79p'><q id='gO79p'><span id='gO79p'><b id='gO79p'><form id='gO79p'><ins id='gO79p'></ins><ul id='gO79p'></ul><sub id='gO79p'></sub></form><legend id='gO79p'></legend><bdo id='gO79p'><pre id='gO79p'><center id='gO79p'></center></pre></bdo></b><th id='gO79p'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gO79p'><tfoot id='gO79p'></tfoot><dl id='gO79p'><fieldset id='gO79p'></fieldset></dl></div>
                    <tfoot id='gO79p'></tfoot>
                    1. <small id='gO79p'></small><noframes id='gO79p'>

                        <bdo id='gO79p'></bdo><ul id='gO79p'></ul>
                      • <legend id='gO79p'><style id='gO79p'><dir id='gO79p'><q id='gO79p'></q></dir></style></legend>
                          <tbody id='gO79p'></tbody>

                            主站蜘蛛池模板: 欧美精品久久久 | 欧美日韩综合精品 | 久久久www成人免费精品 | 亚洲欧美激情精品一区二区 | 久久国产日本 | 午夜小视频在线观看 | 最新毛片网站 | 一区二区三区四区不卡视频 | 自拍偷拍欧美 | 国产精品18hdxxxⅹ在线 | 国产精品福利视频 | 四虎永久免费在线 | 国产精品久久久久久久7电影 | 欧美精品第一页 | 黄色一级视频 | 一级a性色生活片久久毛片波多野 | 国产一区二区影院 | 日本特黄a级高清免费大片 成年人黄色小视频 | av网站免费看 | 亚洲欧洲中文 | 亚洲一区 | 久久久久99 | 久久偷人 | 国产精品一区二区三区在线 | 亚洲视频中文 | 波多野结衣一区二区 | 国产精品黄色 | 在线一区二区三区 | 国产精品久久久久久 | 色婷婷久久久亚洲一区二区三区 | 亚洲精品99| 成人av免费看 | 91精品国产91 | 999视频| 亚洲精品国产成人 | 国产精品久久久久久久久久久免费看 | 精品二三区 | 久久蜜桃av一区二区天堂 | 欧美小视频在线观看 | 久久精品视频在线播放 | 在线观看免费黄色片 |