How to quickly parse the json content in html through php

how to quickly parse the json content of the data_content variable in the following html through php and convert it into an array

<!DOCTYPE html><html><head><title>title</title></head><body><script type="text/javascript">
var is_debug = true;
var data_content = {
id:123123345,
name: "music album",
mode:0,
cover:"abc.png",
audio:{"url":"asdf234sdfasdf.mp3","name":"adsfasdf.mp3","id":123123},
create:123123123123,
memberType: "",
time: null,
tpl: 1,
des: "",
};

var _config={"first":{"second":{"third":"abc.png","src":"","link":"","name":"","bgsrc":"","id":4}}};




</script><script src="https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
<div id="wapShareSet" class="wapShare" style="display:none"></div></body></html>
Php
Jul.16,2021

regular understanding, preg_match understanding


phpPHP also has DOM. Like JS, you can first get the script element and then get the contents of it.

you can also use SimpleXML, to make it easier.

these are default extensions, so check the documentation for specific usage.

Menu