2016-08-13 7 views
0

私のウェブサイトabc.comindex.phpページに内部リンクがあります。 contactus、aboutusなどがあります。PHPページを新しいURLでどのようにリロードできますか?

誰かがページindex.phpのリンク(連絡先と言う)をクリックしたときに、どのようにしてindex.phpに行く必要があるかを教えてください。しかし、index.phpは、新しいURL、つまりabc.com/contactusでリロードする必要があります。

答えて

0

は、それは誰かが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"); 
    } 
} 
0
//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);  
} 
0
<?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'); 
    } ?> 
関連する問題