2011-08-20 64 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"); 
?>