javascript - jwplayer 在我的情况下不显示

标签 javascript php jquery jwplayer

请帮我修复这个脚本:

<?php $aaa = "<script>document.writeln(enc)</script>"; 
?>

var playerInstance = jwplayer("myElement");
    playerInstance.setup({
        width: '100%',
        height: '360',
        title: 'aaaaa',
        description: 'dcascd',
        file: window.atob('<?php echo $aaa; ?>'),

});

我的分机 JavaScript

var str= "http://example.com/video.mp4";
    enc = window.btoa(str);
enc = String(enc);

播放器不显示。请帮我修复此代码。

最佳答案

在您的代码中,$aaa等于脚本标签,所以你最终会得到:

    file: window.atob('<script>document.writeln(enc)</script>'),

你一定要记住,PHP先编译,然后JS运行。

<小时/>

顺序是:

1.

$aaa等于 <script>document.writeln(enc)</script>

2.

var playerInstance = jwplayer("myElement");
playerInstance.setup({
    width: '100%',
    height: '360',
    title: 'aaaaa',
    description: 'dcascd',
    file: window.atob('<script>document.writeln(enc)</script>"; ?>'),
});

关于javascript - jwplayer 在我的情况下不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31945590/

相关文章:

javascript - react .js : the key value in each child component should be unique?

java - 是否有用于在服务器端以编程方式翻译文本的 API?

php - PDO登记表

php - 在搜索框中输入内容时自动显示用户名?

jquery - 在段落中查找一个单词,并将其包裹在一个跨度中

javascript - 如果使用 AJAX 调用,jQuery Tablesorter *Pager* 将无法工作

Javascript - 捕获对对象属性的访问

php - 使用包 ('H*' 验证字符串)

jquery - qTip2在Chrome中的定位

jquery - 如何在自动调整大小时设置日期搜索工具栏字段宽度