2

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

2 回答 2

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>
于 2013-03-08T17:10:44.977 回答
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>
于 2016-02-15T16:57:05.413 回答