如何在JWplayer Javascript中使用PHP路径

时间:2013-03-08 17:07:59

标签: php javascript jwplayer path-variables

如何使用嵌入式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>

2 个答案:

答案 0 :(得分:2)

就像那样

<?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>

答案 1 :(得分:0)

像这样在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>