Heim  >  Artikel  >  Backend-Entwicklung  >  刚上手PHP,最基本问题

刚上手PHP,最基本问题

WBOY
WBOYOriginal
2016-06-23 14:26:561090Durchsuche

我用的是wampserver,然后就可以写.php文件了。
比如可以写a.php文件,然后在浏览器输入 "localhost/a.php" 然后就正常运行。
但是我想仿照w3cschool上这个例子:
建立一个html文件如下:




Name: 

E-mail: 







然后建立一个php文件如下:



Welcome 

Your email address is: 




我把他们放到了我的www目录下,当我打开html文件的时候填写表格,填写完点击sumbit按钮,就会跳转到
file:///C:/wamp/www/php/welcome.php
显示不了传送的信息。如果我手动到 localhost/php/welcome.php就会报错说变量不存在(这是一定,因为没有传过来)。不知道怎么才能让他跳转到正确的localhost?

请问前辈,如何才能让数据正确在html文件和php文件之间传送呢?多谢!

回复讨论(解决方案)

Name: 
E-mail: 

上面的代码改为:

Name: 
E-mail: 

看看

file:///C:/wamp/www/php/welcome.php ???
你在桌面用浏览器打开的你的html文件?

你需要在浏览器地址栏输入: localhost/php/你的html文件

访问html页面的方式和访问php页面访问方式一样,都是http://localhost/xx.html,而不是双击直接打开访问

楼主请问你是用IE打开的吗?

file:///C:/wamp/www/php/welcome.php ???
你在桌面用浏览器打开的你的html文件?

你需要在浏览器地址栏输入: localhost/php/你的html文件

原来需要用localhost打开,明白啦~

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn