<?php
require "connect.php";
$file = "./myFile2.txt";
$document = file_get_contents($file);
$lines = explode("\n",$document);
foreach($lines as $newline) {
$arr = explode('Order Number: ', $newline);
$important = $arr[1]; //getting an error here (undefined offset 1)
echo $important;
$art = explode('Total Price: ', $newline);
$first = $art[1]; //getting an error here (undefined offset 1)
echo $first;
}
?>
myFile2.txt次のように読み取る:1 'の各エコーの後:エラー '不定1オフセット'
Order Number: 12345
Total price: 60$
コード出力の両方 '12345' と'60 $未定義オフセット」は、まだ表示され' 。
どうすればこの問題を解決できますか?注文番号と合計金額を分けるリターンキーを考慮する必要がありますか?
と
;'印刷を? – Akshay
これはSQLとは関係がないようですので、タグを削除しました。 –
string(6) "12345"と60 $ NULL – T888