Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php refresh current page?

I have a page which,

If a variable is set(in a session) it will do an action, then it unsets the session.

Now it has to refresh itself.

This is where i am stuck.

Is there a way to get the exact url to the current page?

or is there a function to do this?

so header('location: ???');

like image 824
Hailwood Avatar asked Nov 19 '10 00:11

Hailwood


People also ask

How can I refresh the page in PHP?

PHP is server-side language, so you can not refresh the page with PHP, but JavaScript is the best option to refresh the page: location. reload(); The visit Location reload() method.

How do you refresh a page in HTML?

Most people know it can be done by hand by holding the shift key and clicking the “Refresh” (on IE) or “Reload” (on Navigator) buttons.

How to periodically refresh the page in PHP?

Use the header () Function to Periodically Refresh the Page in PHP We can use the header () function to refresh the page in PHP. We write the Refresh header inside the header () function and specify the time interval for refreshing the page. For example, write a header () function and specify the time interval of 1 second as header ("Refresh:1").

How do I refresh the current page after 5 seconds?

In the PHP code above, we sent a Refresh header to the browser by using PHP’s header function. This meta refresh header tells the browser that it should refresh the current page after five seconds. Obviously, you can change the $refreshAfter variable to suit your own needs.

What is the difference between redirecting and refreshing in PHP?

Solid Tip: PHP is limited to using a meta tag to actually ‘refresh’ a page. ‘Redirecting’ a page is another story. The term ‘refresh’ suggests that a page existed already.

How to return to the previous page in PHP?

This article will introduce some methods to return to the previous page in PHP. The HTTP_REFERER request header returns the URL of the page from where the current page was requested in PHP. The header enables the server to acknowledge the location from where the users are visiting the current page.


1 Answers

header('Location: '.$_SERVER['REQUEST_URI']); 
like image 85
Byron Whitlock Avatar answered Oct 14 '22 04:10

Byron Whitlock