【问题标题】:Access php files through a link on the web通过网络上的链接访问 php 文件
【发布时间】:2014-05-13 11:39:59
【问题描述】:

我创建了一个非常简单的 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 代码,我会通过 wamp 从 apache 服务器运行它。

我想问你,如果我想在互联网上将它加载到特定的 URL,我该怎么做? 例如,打开我的网络浏览器并在 URL 地址处写入:http://www.exampleWebSite.com,然后我的页面就会显示出来。

谢谢

【问题讨论】:

  • 这不是编程问题。但它的要点是 1) 获得域名 2) 获得网络托管 3) 将文件上传到托管
  • 如果要显示页面,首先应该将其上传到服务器。并将文件名设置为index.html/index.php。这是服务器要查找的第一个页面。跨度>

标签: php html


【解决方案1】:

简而言之:您无法按照您建议的方式实现您想做的事情。 首先,您需要拥有 said 域并为其提供托管服务。

如何:

  1. domain registrar (Google search)购买域名
  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);
}

?>

注意

我刚刚注意到您有一个表单可以链接到您的注册页面。为什么不使用专为此类事情设计的 &lt;a&gt; (ANCHOR) 元素。

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

【讨论】:

    【解决方案2】:

    您可以使用标签或将表单的操作属性更改为您的示例网站。

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

    不使用表单

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

    【讨论】:

      【解决方案3】:

      您应该将您的 html 文件上传到您的网络服务器。这是不可能的。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-09-11
        • 2013-07-08
        • 1970-01-01
        • 1970-01-01
        • 2017-11-29
        • 2021-01-06
        • 1970-01-01
        • 2011-09-15
        相关资源
        最近更新 更多