教程
在config.php配置json接口和授权调用ip
缓存时间:官方资源建议三个小时以下,10800秒 切片资源理论上可以随便写久点
m3u8 会直接缓存内容,mp4或者其他格式会缓存url
清理缓存功能配置,在宝塔定时任务添加 访问url,url写 你的网站/clear.php,调用时间周期按你个人所需
在config.php 配置当前网站的域名$web
如果缓存资源需要让网站播放,需要配置跨域
nginx:
在 网站->配置文件 中间任意部分添加
add_header Access-Control-Allow-Origin ‘*’;
add_header Access-Control-Allow-Methods ‘POST,PUT,GET,DELETE’;
add_header Access-Control-Allow-Headers ‘version, access-token, user-token, Accept, apiAuth, User-Agent, Keep-Alive, Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With’;
apache:
在 网站->配置文件 中间任意部分添加
Header set Access-Control-Allow-Origin *
Header set Access-Control-Allow-Credentials true
Header set Access-Control-Allow-Headers “Origin, X-Requested-With, Content-Type, Accept”
如果网站有多个端口,需要在对应端口代码中间添加,尤其是80和443端口
说明
可设置轮询和并发两种功能,轮询就是挨个接口调用直到出结果,并发就是同时调用所有接口,取最先出结果的,建议大家用轮询,并发有点费钱
1