Home  >  Article  >  Backend Development  >  PHP 环境搭建之后的第一个PHP程序

PHP 环境搭建之后的第一个PHP程序

WBOY
WBOYOriginal
2016-06-23 13:44:23881browse

作者:卿笃军


本文写给自己看,这个问题纠结了我很久,我是php超级新手;


我去同学那里拷贝了一个xampp然后安装好之后就可以搞PHP开发了,我的默认localhost目录是:C:\xampp\htdocs

这里php表单提交需要注意一点:

不能直接点击HTML打开页面,这样就没有了http://localhost前缀,就无法正确的将HTML文档提交到PHP文档中。

这里必须将HTML,PHP全部放在你的localhost目录下面(可以在子目录下面)。


比如我的:我在默认目录下面新建了一个php的文件夹~~~


然后,我在这个文件夹里面搞了2个文件,1.html,1.php


注意:访问html的时候,在地址栏输入如下xxxxxxx。(不能直接点击1.html来打开网页)。

嘿嘿,点击提交后,和php交互之后的结果..........

自己编写了一个网页提交数据,php处理的小程序;

1、HTML代码

   <meta charset="UTF-8">  <meta name="Author" content="Dolphin">  <title>HTML表单</title>    

名字:

来自:

2、php代码

大家好,我是<?php echo $_POST['user_name'];?>!<?php echo "<br/>"?>我来自<?php echo $_POST['hometown'];?>.

原文地址:http://blog.csdn.net/qingdujun/article/details/41577327

参考文献:零基础PHP学习(第3版) 陈浩 编著

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn