我有一个使用 curl 下载并插入字符串的 HTML 文件。HTML 文件有很多内容,但我希望解析文档的某个部分并将该部分插入到数组中。棘手的部分是我试图解析的部分不是 HTML,它是 JavaScript 块中的代码:
<!-- script block -->
<script type="text/javascript" src="//external.site.com/76b07.js"></script>
<script>....code.....
"235533":{"itemId":"235533","type":"0","image":{"url":"thispic.jpg"}:"summary":"This Item"},
"235534":{"itemId":"235534","type":"1","image":{"url":"thisotherpic.jpg"}:"summary":"This Other Item"},
</script>
如何将项目信息作为数组导入?:
$array = array( "itemId" => "235533", "type" => "0", "image" => "thispic.jpg", "summary" =>"This Item" );