【发布时间】:2011-12-10 19:21:51
【问题描述】:
我有一个非常基本的问题。请考虑一个带有子域的网站:
主站点:www.domain.com
子域 1:sub1.domain.com
子域 2:sub2.domain.com
http://www.domain.com/index.php 中的主站点有一个表单:
<form action="http://sub1.domain.com" method="post">
<input type="text" name="userInput">
<input type="submit">
</form>
数据是否会发布到http://sub1.domain.com 并可以通过以下方式访问:(?)
<?php
$input = $_POST['input']
//the goal is to make $input, a variable in http://sub1.domain.com/index.php
//equal to what the user submitted in the form at http://www.domain.com/index.php
?>
我只需要加载 sub1.domain.com/index.php 并显示已发布的变量,没有实时的幻想。根据我的阅读,我确定可能有一个设置阻止了 apache 或其他应用程序中的此活动,但从理论上讲,数据应该能够使用 POST 从任何域/子域发送到任何域/子域,对吗?
【问题讨论】:
-
你能链接到那个阅读吗?这可能会有所帮助。
-
正确,只要通过 HTTP 访问两个域,浏览器就会愉快地将表单从一个域的页面发布到不同域的某个位置。
-
感谢达克塞尔罗德。 FakeRainBrigand,我确实读过一些关于防止来自不同域的帖子的内容。事实证明,我读到的内容实际上并没有说明阻止来自 Apache 的 POST 请求,而是使用 PHP _SERVER 超全局变量中的 HTTP_REFERER 变量。这是网址:roshanbh.com.np/2008/06/…
标签: php forms post dns subdomain