2011-08-20 71 views
1

如果我的網站是基於包含的,我怎樣才能讓GET請求正常工作?

例如在index.html中,我依靠<!--#include virtual="/includes/columns/col-2.shtml" -->來顯示內容。

而在col-2.shtml我得到這個簡單的腳本<?php $success = $_GET['success']; if($success == 1) { echo "User created!"; }?>

所以,當我瀏覽到http://www.mysite.com/index.html?success=1它不顯示我的回聲。並且.shtml被設置爲在.htaccess中解析php。

任何想法?

+0

嗯。 apache虛擬進程綁定到.shtml時是否實際處理了PHP? – hakre

+0

查看源代碼時,您跳轉到該頁面 - 您可能會發現您的<?php標記正在顯示,但不會被瀏覽器呈現!) – Mez

回答

4

你似乎在這裏混合你的技術!

重命名的index.html的index.php(或index.shtml),並更改包括要

<?php 
include('/includes/columns/col-2.shtml'); 
?> 
+0

如果我使用index.php並使用php include,則無法在Dreamweaver中預覽... –

+1

@David Meyer:這就是測試服務器的用途。 – animuson

+2

不要在Dreamweaver中預覽。 –

0

包括不自然發送GET/POST信息...你可以試試這個:

<? 
$_POST[username]="123456"; 
include("login.php"); 
?> 
相關問題