I would like to know if there is any way to refresh the page with php in a way that is not with the location.
Because for the moment I have not been able to find another way
I would like to know if there is any way to refresh the page with php in a way that is not with the location.
Because for the moment I have not been able to find another way
In fact I think it is only
header
defined for this purpose, when you have:As described on the official site: http://php.net/manual/es/function.header.php
An important aspect to consider is that you should avoid exits prior to the execution of this statement, since things like these could cause problems:
Example 1: a common output.
Example 2: Any output, even a line break
Keep in mind that although this can be partially solved with ob_start as indicated here http://php.net/manual/es/function.ob-start.php
While the above works, the snippet below will not:
you may find this article on the subject entertaining .
Another option is to generate a temporary page that performs the task "this would be useful to give the server a break in executions that are too long, since it is on the client where the redirection is triggered"
As an alternative to redirect your page you can use the meta tag, like this:
where:
An extra option is to use javascript, as mentioned above these alternatives can be used if you want to display a transient page «Like those with the message, "You are redirecting to the site..."».
Yes there is a way:
The parameter that refresh receives is time in seconds, so if you put no se 15 the page would not be redirected until 15s after the php is executed.
What the above line does is get the current file path so you don't need to put a specific url if you're going to use that same code on different pages, but if you want to put a different url anyway you can put it, just replace what's after url with whatever path you want.
Cheers!
It can help you:
What this does is that it redirects you to
pagina.php
when it reaches that line of php code .These are other forms of redirection:
Option 1:
Option 2: