通过网络上的链接访问php文件 [英] Access php files through a link on the web

查看:90
本文介绍了通过网络上的链接访问php文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

 < html> 
< head>
< title>客户端登录< /标题>
< / head>
< body>
< form method =postaction =Sign up.php>
< table width ='400'cellpadding = '10'cellspacing ='1'align ='left'style ='margin:186 90'border ='0'>
< td>< font size =3face =arial,helvetica>没有账号?请注册
< td>< font size =3face =arial,helvetica>< input type ='submit'name ='signup'value ='Sign Up'/>
< / table>
< / form>
< / body>
< / html>

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



我想问你,如果我想在互联网上加载到特定的URL,我该如何做?
例如,要打开我的Web浏览器并在URL地址中写入: http://www.exampleWebSite.com ,然后显示我的页面。

谢谢

解决方案

总之: / strong>您无法按照您的建议达到您想要的效果。
首先,您需要拥有表示的域名并为其托管。



如何:




  1. 域名注册商(Google搜索)

  2. 购买 域名( )与域名注册机构
  3. 文件到你的主机。
  4. 通过你的域访问你的文件(不管它是什么)。例如 http://www.myderpydomain.com

这样你现在就可以运行你的文件了(在这个例子中,我们称之为 index.html

 < html> 
< head>
< title>客户端登录< /标题>
< / head>
< body>
< form method =postaction =Sign_up.php>
< table width ='400'cellpadding = '10'cellspacing ='1'align ='left'style ='margin:186 90'border ='0'>
< td>< font size =3face =arial,helvetica>没有账号?请注册
< td>< font size =3face =arial,helvetica>< input type ='submit'name ='signup'value ='Sign Up'/>
< / table>
< / form>
< / body>
< / html>

现在您可以看到,表单操作设置为 Sign_up。 PHP 。你需要这个文件来处理你的表单,我记得你会写出来。但同时还有一个placeholder脚本。

 <?php 

if(!empty($ _ POST)){
print_r($ _ POST);
}

?>



注意



我刚注意到你有链接到您的注册页面的表单。为什么不使用专为这种类型设计的 < a> (ANCHOR)元素。

 < a href =Sign_up.php>立即注册< / a> 


I have created a very simple html page. Below is the code of the html file

<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>

moreover if i add some php code inside I run it through wamp from an apache server.

I would like to ask you if i want to load this on the internet to a specific URL how can i do it ?? For example, to open my web browser and write at the URL address: http://www.exampleWebSite.com and then my page to show up.

Thank you

解决方案

In short: NO you can not achieve what you'd like to do in the way you suggested. First off, you'd need to own said domain and have hosting for it.

How to:

  1. Purchase a domain name from a domain registrar (Google search)
  2. Purchase hosting for said domain (optionally with the domain registrar)
  3. Upload files to your hosting.
  4. Access your file through your domain (whatever it may be). For example http://www.myderpydomain.com

That way you can now run your file (for this example we shall call it 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>

and now as you can see, your form action is set to Sign_up.php. You need this file to process your form, which I pressume you will write up. But here's a "placeholder" script in the mean time.

<?php 

if(!empty($_POST)) {
print_r($_POST);
}

?>

NOTE

I just noticed you have a form to link to your sign-up page. Why not use an <a> (ANCHOR) element which was designed for this kind of thing.

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

这篇关于通过网络上的链接访问php文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆