【问题标题】:How to use PHP path inside JWplayer Javascript如何在 JWplayer Javascript 中使用 PHP 路径
【发布时间】:2013-02-24 07:43:22
【问题描述】:

如何使用嵌入式 JWplayer Javascript 中的变量编写我的 php 路径? 我是 php 新手,没有 Javascript 代码经验。 我将不胜感激。

**This absolute path works:**
 <script type="text/javascript">
 jwplayer("myElement").setup({
    file: "/uploads/example.mp4",
    height: 360,
    image:  "http://saradyso.com:8020/SuperContainer/RawData/MediaWeb/REG002133749/ADP100000033/Video1.mp4",
    width: 640
    });
 </script>

**This doesn't work:**
<script type="text/javascript">
 jwplayer("myElement").setup({
    file: "/uploads/example.mp4",
    height: 360,
    image:"http://'.$Domain.':'.$Port.'/'.$ContainerV.'/'.$FileName.'/'.$SubFolder.'.mp4'",
    width: 640
    });
 </script>

【问题讨论】:

  • 你的意思是你想要一个返回 mp4 文件的 php 脚本?

标签: php javascript jwplayer path-variables


【解决方案1】:

就这样

<?php $your_path = "some/path/to/to.image" ?>

 <script type="text/javascript">
 jwplayer("myElement").setup({
    file: "/uploads/example.mp4",
    height: 360,
    image: <?php ehco $your_path ?>,
    width: 640
    });
 </script>

【讨论】:

    【解决方案2】:

    像这样在 php 块中使用 echo。

    <script type="text/javascript">
     jwplayer("myElement").setup({
        file: "/uploads/example.mp4",
        height: 360,
        image:"http://<?php echo $Domain ?>:<?php echo $Port ?>/<?php echo $ContainerV ?>/<?php echo $SubFolder ?>/<?php echo $FileName ?>.mp4",
        width: 640
        });
     </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-07
      • 2019-10-24
      • 2011-05-07
      • 2020-03-08
      • 1970-01-01
      • 2020-05-04
      • 2020-05-25
      相关资源
      最近更新 更多