如何让我的PHP页面每2分钟使用javascript重新加载?

Every two minutes i want to check whether i received some message so want to reload my page every 2 minutes how to reload my php page using javascript

<body onload="setInterval('window.location.reload()', 120000);">

Quick and dirty:

setTimeout( function() {
    location.reload()
}, 120000);

Though I think there could possibly be a fancier way of doing this, this is just what I know though.

I recommend looking into doing it with ajax. Look at the jQuery library, or any of the JavaScript libraries.

http://jquery.com/

Why are you sticking on javascript. You can do this without Javascript too. <meta http-equiv="refresh" content="2;url=http://path/to/the/page" />

The easiest way I found out which is also javascript proof.

This code goes in between the HEAD tags.

<META HTTP-EQUIV="refresh" CONTENT="15">

The above code reloads the page every 15 seconds. Change 15 to the desired value as required. For eg; 300 for a page to reload every 5 minutes.

      <meta http-equiv="refresh" content="n">

What if your client doesn't have javascript e.g feature phone browsers? Put that in the head folder of your HTML header. n is the number of seconds for the refresh intervals.