File_get_contents并使用javascript回显

时间:2019-03-08 02:33:51

标签: javascript

我对js不熟悉。我想获取“ file_get_contents”函数的结果并将其放在“源”上(我都用“ https://................标记了。)。

谢谢。

<script>
var myInit = {
referrer: '',
};
function file_get_contents(filename) {
fetch(filename, myInit).then((resp) => resp.text()).then(function(data) {
    content = JSON.parse(data)
    fetch(content['some']['media']['content'], myInit).then((resp) => 
resp.text()).then(function(data));});}
file_get_contents("https://.................");
</script>

<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/clappr@latest/dist/clappr.min.js"> 
</script>
</head>
<div id="player"></div>
<script>
    window.onload = function() {
        var player = new Clappr.Player({
            source: 'http://......................',
            parentId: "#player",
            height: '100%',
            width: '100%',
            autoPlay: true,
        });};
</script>
</body>
</html>

0 个答案:

没有答案