我有代码为客户端带来实时ts文件
我有包含动态文件的文件夹
/files
1_0.ts
1_1.ts
1_2.ts
我的代码使用该代码将文件带到客户端
$files = "";
$files = glob('/files/1_*.ts');
foreach ($files as $file) {
readfile($file);
}
代码获取所有文件并将其发送到客户端,一切正常
我需要客户端每次到达最后一个元素时再次继续读取文件,直到他关闭浏览器
更多解释
client get
1_0.ts
1_1.ts
1_2.ts
and watch them , I need client to read them again when he at the last file
1_0.ts
1_1.ts
1_2.ts
1_0.ts
1_1.ts
1_2.ts
1_0.ts
1_1.ts
1_2.ts
etc ..... until client close by itself
答案 0 :(得分:0)
您可以使用以下内容:
while (!connection_aborted()) {
// here goes Your code that reads the files
foreach (glob('/files/1_*.ts') as $file)
readfile($file);
// some waiting may be useful here?
sleep(1);
}