通过web上的链接访问php文件


Access php files through a link on the web

我创建了一个非常简单的html页面。下面是html文件

的代码
<html>
    <head>
        <title>Client Login</title>
    </head>
    <body>
        <form method="post" action="Sign up.php">
            <table width='400' cellpadding='10' cellspacing='1' align='left' style='margin:186 90' border='0'>          
                <td><font size="3" face="arial, helvetica">Don't have an account? Please register 
                <td><font size="3" face="arial, helvetica"><input type='submit'  name='signup' value='Sign Up'/>
            </table>
        </form>     
    </body>
</html>

如果我在里面添加一些php代码,我会在apache服务器上通过wamp运行它。

我想问你,如果我想在互联网上加载这个到一个特定的URL,我怎么能做到呢?例如,打开我的web浏览器,在URL地址上写:http://www.exampleWebSite.com,然后我的页面就会显示出来。

谢谢

总之:NO你不能按照你建议的方式完成你想做的事情。首先,您需要拥有所说的域名并为其提供托管服务。

如何:

  1. 从域名注册商处购买域名(Google搜索)
  2. 所述域名购买主机(可选择与域名注册商)
  3. 上传文件到主机
  4. 通过域名访问文件(无论域名是什么)。例如http://www.myderpydomain.com

这样你就可以运行你的文件了(在本例中我们将其命名为 index.html )

<html>
    <head>
        <title>Client Login</title>
    </head>
    <body>
        <form method="post" action="Sign_up.php">
            <table width='400' cellpadding='10' cellspacing='1' align='left' style='margin:186 90' border='0'>          
                <td><font size="3" face="arial, helvetica">Don't have an account? Please register 
                <td><font size="3" face="arial, helvetica"><input type='submit'  name='signup' value='Sign Up'/>
            </table>
        </form>     
    </body>
</html>

,现在你可以看到,你的表单动作被设置为Sign_up.php。您需要这个文件来处理您的表单,我猜您将编写表单。但是这里有一个"占位符"脚本。

<?php 
if(!empty($_POST)) {
print_r($_POST);
}
?>

注意

我刚刚注意到你有一个表单链接到你的注册页面。为什么不使用 <a> (ANCHOR)元素呢?它就是为这种事情设计的。

<a href="Sign_up.php">Sign Up Now</a>

您可以使用标签或更改表单的action属性到您的示例网站。

<form action="post" method="http://www.example.com">

不使用表单

<a href="http://www.example.com">Sign Up</a>

你应该把你的html文件上传到你的web服务器。这是不可能的。