我在这里看到很多关于将多维数组转换为字符串的帖子,但不是相反,所以我有一个问题要问。我得到了以下通过帖子从 JQuery 数组中检索到的数据字符串:
["enquiry@gardengamesltd.co.uk, sales@gardengamesltd.co.uk","http://www.gardengamesltd.co.uk/acatalog/contactus.html"],["enquiry@gardengames.com","http://www.gardengames.com/contact/"],["info@gardengamesandleisure.com","http://www.gardengamesandleisure.com/ContactUs.aspx"],["playtime@kentgardengameshire.com","http://www.kentgardengameshire.com/contact-us.html"],["sales@gardengamesuk.com","http://www.gardengamesuk.com/contact.php"],["team@gardenknightgames.com","http://www.gardenknightgames.com/contact/"],["ajax-loader@2x.gif","http://www.just-garden-games.co.uk/"]
我想要做的是将它转换成一个看起来像这样的数组:
Array
(
[0] => Array
(
[Email] => enquiry@gardengamesltd.co.uk, sales@gardengamesltd.co.uk
[FB] => http://www.gardengamesltd.co.uk/acatalog/contactus.html
)
[1] => Array
(
[Email] => enquiry@gardengames.com
[FB] => http://www.gardengames.com/contact/
)
[2] => Array
(
[Email] => info@aaeventhire.com
[FB] => http://www.aaeventhire.com/pricing/garden-games
)
)
我意识到我可以使用$array = explode('","', $harvest_data);
,但这只会给我一个单级数组,理想情况下我想将电子邮件、fb 保留在内部数组中。
有没有人对我如何去做这件事有任何想法?
谢谢。