私のウェブサイトabc.com
のindex.php
ページに内部リンクがあります。 contactus、aboutusなどがあります。PHPページを新しいURLでどのようにリロードできますか?
誰かがページindex.php
のリンク(連絡先と言う)をクリックしたときに、どのようにしてindex.php
に行く必要があるかを教えてください。しかし、index.php
は、新しいURL、つまりabc.com/contactus
でリロードする必要があります。
私のウェブサイトabc.com
のindex.php
ページに内部リンクがあります。 contactus、aboutusなどがあります。PHPページを新しいURLでどのようにリロードできますか?
誰かがページindex.php
のリンク(連絡先と言う)をクリックしたときに、どのようにしてindex.php
に行く必要があるかを教えてください。しかし、index.php
は、新しいURL、つまりabc.com/contactus
でリロードする必要があります。
は、それは誰かがindex.phpの上、その後
リンク をクリックしたときには、
<a href="index.php?link=contact_us">Contact Us</a>
よう
リンクメニューの宣言リンクをしたいと作品を願って
if(isset($_GET['link']))
{
$link =$_GET['link'];
if($link == 'contact_us')
{
header("location:contact_us.php");
}
}
//Contact us link
<a href="index.php?redirect_url=contact_us">Contact Us</a>
//Javascript code
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var redirect_url = getParameterByName('redirect_url');
//will redirect to contact us page after 3 seconds. You can change it as per your requirement
if(redirect_url){
setTimeout(function(){ window.location.href = redirect_url; }, 3000);
}
<?php
/*we will use this this function ob_start() in the first of php page to redirect the users after your submit data
ob -> output buffering */
ob_start();
?>
<!--for example -->
<?php
/*write this function in the first of php page*/
ob_start();
?>
<?php
/*write your Query here after you write your query you will write the page that you will direct the users for example */
header('location:index.php');
} ?>