在此程序中,我製作了一個標題爲google.co.in的PHP文件。讓我們來看看代碼PHP中的標題不起作用
<?php
session_start();
$status=$_POST['input'];
if (isset($status)) {
header('Location: http://google.co.in/');
}
?>
,我有一個有另一個文件的javascript,讓我們看看到
<?php
session_start();
echo time();
?>
<html>
<head>
<title>my app</title>
<script type="text/javascript" src="jquery-2.0.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(this).mousemove(function(){
$.post('logout.php',{input: 1});
//window.location.href="logout.php"
});
});
</script>
</head>
<body>
<h2>we are on the main_session</h2>
</body>
</html>
現在的問題是,當我在我的本地運行此我沒有被重定向到google.co.in而是在螢火蟲中顯示302錯誤。但是,當我使用我在代碼中評論的window.location.href語法,而不是我被重定向到google.co.in時。請告訴我這背後有什麼問題。
如果你想
您已經評價重定向代碼 – Suleman
是.....我曾評論它 –
請取消註釋它重定向成功 – Suleman