首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在php5下工作,但不适用于php7

问在php5下工作,但不适用于php7
EN

Stack Overflow用户
提问于 2018-05-20 03:23:46
回答 2查看 153关注 0票数 0

这个片段在php5.6中工作,但在php7中不起作用。

代码语言:javascript
复制
mp3: <script language = "php"> echo "\"" . $MP3FILE . "\"";</script>

错误是: Uncaught :意外令牌<(我已经确认php7正在运行,并在我的服务器上处理php文件)。

这个站点是:在php5.6下工作的DNSpanishEnglish.php。这是整个陈述,只是为了上下文。

代码语言:javascript
复制
$(document).ready(function(){
  $("#jQ_jP").jPlayer( {
          ready: function () {
                  $(this).jPlayer("setMedia", {
                         mp3: <script language = "php"> echo "\"" . $MP3FILE . "\"";</script>
                // Defines the mp3 url
          });
         startingTime = 45;
         //endingTime = $(this).jPlayer("status", "duration");
         //myAlert( "  endingTime is " + endingTime);
                  $(this).jPlayer("play", 45);  // THIS WORKS!!!!!
                  //$(this).jPlayer("play").jPlayer("stop").jPlayer("playHead", ).jPlayer.status.currentTime);
                  //$(this).jPlayer("playHead", {time: 50});
                  //$(this).jPlayer("play" , { time: 45 }); // works (required for auto-play), but the time args doesnt work.
          //  $(this).jPlayer("playHeadTime" , { time: 45000 });
         $("#jQ_jP").bind($.jPlayer.event.play, function(event) {
                  // Add a listener to report the time play began
                  //myAlert("HELLO from jplayer_1" +
                         //"Play began at time = " +
                  //     event.jPlayer.status.currentTime
                                  //);  // OK, this is happening.
                  //$("#jQ_jP").playHead(50); //doesnt work.
                  $("#jQ_jP").playHeadTime(45000);
                        // milliseconds. doesnt work.
         });
         $("#jQ_jP").playHeadTime(5000); // doesnt work.
          } // End of "ready". No semicolon here!
 });
});
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-05-20 04:04:03

这将由于更新版本的PHP7删除这些标记的支持而发生。您可以使用标准标记代替它喜欢或。希望这能帮到你。

​

票数 2
EN

Stack Overflow用户

发布于 2018-05-20 03:56:43

在php中的其他地方定义变量,您可以在该脚本中使用它。

代码语言:javascript
复制
$MP3FILE = <?php echo $MP3fileLink ?>

JS

代码语言:javascript
复制
$(document).ready(function(){
  $("#jQ_jP").jPlayer( {
          ready: function () {
                  $(this).jPlayer("setMedia", {
                         mp3: $MP3FILE 
                // Defines the mp3 url
          });
         startingTime = 45;
         //endingTime = $(this).jPlayer("status", "duration");
         //myAlert( "  endingTime is " + endingTime);
                  $(this).jPlayer("play", 45);  // THIS WORKS!!!!!
                  //$(this).jPlayer("play").jPlayer("stop").jPlayer("playHead", ).jPlayer.status.currentTime);
                  //$(this).jPlayer("playHead", {time: 50});
                  //$(this).jPlayer("play" , { time: 45 }); // works (required for auto-play), but the time args doesnt work.
          //  $(this).jPlayer("playHeadTime" , { time: 45000 });
         $("#jQ_jP").bind($.jPlayer.event.play, function(event) {
                  // Add a listener to report the time play began
                  //myAlert("HELLO from jplayer_1" +
                         //"Play began at time = " +
                  //     event.jPlayer.status.currentTime
                                  //);  // OK, this is happening.
                  //$("#jQ_jP").playHead(50); //doesnt work.
                  $("#jQ_jP").playHeadTime(45000);
                        // milliseconds. doesnt work.
         });
         $("#jQ_jP").playHeadTime(5000); // doesnt work.
          } // End of "ready". No semicolon here!
 });
});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50431368

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档