这个片段在php5.6中工作,但在php7中不起作用。
mp3: <script language = "php"> echo "\"" . $MP3FILE . "\"";</script>错误是: Uncaught :意外令牌<(我已经确认php7正在运行,并在我的服务器上处理php文件)。
这个站点是:在php5.6下工作的DNSpanishEnglish.php。这是整个陈述,只是为了上下文。
$(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!
});
});发布于 2018-05-20 04:04:03
这将由于更新版本的PHP7删除这些标记的支持而发生。您可以使用标准标记代替它喜欢或。希望这能帮到你。

发布于 2018-05-20 03:56:43
在php中的其他地方定义变量,您可以在该脚本中使用它。
$MP3FILE = <?php echo $MP3fileLink ?>JS
$(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!
});
});https://stackoverflow.com/questions/50431368
复制相似问题