【发布时间】:2018-10-30 01:53:05
【问题描述】:
这个 sn-p 在 php5.6 中有效,但在 php7 中无效。
mp3: <script language = "php"> echo "\"" . $MP3FILE . "\"";</script>
错误是: 未捕获的 SyntaxError:意外的令牌
该网站是: DNSpanishEnglish.php 它在php5.6下工作。 这是整个声明,仅供参考。
$(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!
});
});
【问题讨论】:
-
为什么是
<script language="php">?为什么不<?php?或者更好,<?=。
标签: javascript php