只刷一次页面一次php

时间:2015-12-04 14:26:47

标签: php refresh

我在我的网站上使用PHP并点击myfile.php说我希望页面只刷新一次: 代码就像:

<?php 
 if(called from myfile.php){
 header(refresh:0);
 }
Php code 1;
PHP code 2;
.
.
.
PHP code n;
?>

如何实现这种情况?

3 个答案:

答案 0 :(得分:3)

我并不完全明白你想要做什么,但我认为你需要类似的东西:

for

我刚用 index.php 进行测试。

答案 1 :(得分:2)

你可以这样做:

GET

如果Sub AgreeAll() Dim myRange As Range For Each cell In UsedRange.Cells If cell.Interior.Color = RGB(255, 192, 0) Then If myRange Is Nothing Then Set myRange = cell Else Set myRange = Union(myRange, cell) End If End If Next If Not myRange Is Nothing Then myRange.Interior.Color = RGB(255, 255, 255) Range("P7").ClearContents Columns("E:F").EntireColumn.Delete End If End Sub 参数不存在,那将重新加载页面。

答案 2 :(得分:1)

myfile.php中设置会话变量

session_start();
$_SESSION['calledFrom'] = 'myfile.php';

并在此文件中检查

session_start();
if(isset($_SESSION['calledFrom'])) && 'myfile.php' == $_SESSION['calledFrom']) {
    $_SESSION['calledFrom'] = 'thisfile.php';
    header("Refresh:0");
} else {
    $_SESSION['calledFrom'] = 'thisfile.php';
}