这是我所拥有的:
在包含函数的文件中:
global $numTrax;
然后我在 html 页面中调用一个函数,它只是播放器的 html,但是,那时我想输入它播放的曲目数:
audioPlayer(5);
函数是
function audioPlayer($numTrax)
{
echo ' ... all html ...';
// if i echo $numtrax here it shows 5
// because function i used was audioPlayer(5)
// so, i'm reassigning it using $numTrax = $numTrax
// then next function: audioPlaylist($user_id,$username,$numTrax); has $numTrax
// but the problem is it's not showing it there
$numTrax = $numTrax;
return $numTrax;
}
然后我在页面下方有另一个函数,它创建曲目列表并调用如下:
audioPlaylist($user_id,$username,$numTrax);
问题是$numTrax
没有被执行
问题我可以让变量$numTrax
通过函数吗?