I have 5 PHP files, (1.php,2.php,3.php,4.php,5.php) how can I load 1.php for 5 mins, then load 2.php for 5 mins then again 1.php after that 3.php in a specific order.
I have tried it with a button but I want it to do that without buttons just 5 mins then move on
a server just response to clients requests , as its name explaied , it will be serve your request and give it to you. so when you request 1.php and recieve it in client , for changing it you must create a new request and gets new server response, it can be done by javascript and specially by ajax request . although there is another way for achiving this requirement and it is : getting all 1-5 .php files in one request and shows them in sequesnce , obviously in this aproach you needs to js too but atleat you will decrease your requests to server and this is how SPA appliactions works (in an abstract description) so you must do something as blow :
function keepAlive() {
doAjaxCall();
}
window.onload = function() {
var interval = window.setInterval(function() { keepAlive(); }, 5 * 60 * 1000);
}
and then define your ajax call :
function doAjaxCall(){
$.ajax({
type: "POST",
url: "/route/to/nextFileHandler.php",
data: "current=current_php_file_number",
timeout: 5000,
success: function(data) {
$('body').html(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus);
},
});
return false;
});
beside of "serInterval" sister function : "setTimeout" you can call another approaches to , using :
<meta http-equiv="Refresh" content="300">
metha data leads to refresh your page every 300 sec (5 min), then you can load your ajax call on load jquery events.
in any case , you must be friend with js !