我有一个很难做this..so我有以下文本文件拆分文本到一个多维数组PHP
The Boys in the Boat Daniel James Brown 067002581X 19.99 5 16.99 9 16.99
Harry Potter and the Cursed Child J. K. Rowling, Jack Thorne, John Tiffany 1338099133 18.95 25 17.98 0 17.98
Just Mercy Bryan Stevenson 0812994520 17.50 8 16.25 10 16.25
Me Before You Jojo Moyes 0670026603 18.95 2 17.50 1 17.25
A Thousand Splendid Suns Khaled Hosseini 1594489505 19.00 7 15.50 4 14.95
The Wright Brothers David McCullough 1476728742 21.95 3 18.95 3 18.95
我需要以某种方式使用函数来读入一个2维关联数组.. 我没有问题,从头开始创建INFACT我已经做了阵列,即...,阵列应该像
$books = array(
"The Boys in the Boat" => array (
"author" => 'Daniel James Brown',
"isbn" => '067002581X',
"hardcover" => 19.99,
"quantity" => 5,
"softcover" => 5.99,
"e-book" => 6.99,
),
"Jungle" => array (
"author" => 'Upton Sinclair',
"isbn" => '067002581',
"hardcover" => 19.99,
"quantity" => 5,
"softcover" => 5.99,
"e-book" => 6.99,
),
);
我不知道如何创造条件,经过一个功能逐行扫描文件文本并制作二维数组...我知道我必须这样做使用爆炸,但我不知道使用什么样的分隔符,因为如果我使用了空格,它将无法工作,并且文件中没有其他的分隔符。请帮助我花了整整一天的时间...
它看起来像字段是制表符分隔,所以拆分对制表符(''\ t'')。 – smarx
伟大的是有道理的....现在我怎么让钥匙成为我自己的价值观,如作家,isbn等?谢谢 –
为什么你不分享你到目前为止的代码和你被卡住的地方? – smarx