4

ページを別のページにリダイレクトする必要がありますが、header機能を使用できません。他の方法はありますか?

私がする必要があるのは、次のようなものです:

if (test){
   ---do something---
   redirect
} else {
   return false
}

ありがとう

4

4 に答える 4

19
if (test){
   ---do something---
   die("<script>location.href = 'http://www.google.com'</script>");
} else {
   return false;
}
于 2013-08-13T10:41:03.673 に答える
5

メタリダイレクト

    if (test){
       //do something
       echo '<META HTTP-EQUIV="Refresh" Content="0; URL=yourpage.php">';//This causes the browser to open the new page after 0 seconds, i.e immediately.
    }  else {
       return false;
    } 
于 2013-08-13T10:35:47.537 に答える