Home  >  Article  >  php教程  >  php 页面之间传值实例教程

php 页面之间传值实例教程

WBOY
WBOYOriginal
2016-06-08 17:27:391293browse
<script>ec(2);</script>

传值方法很多,
参数传值: 可以是urs.php?id=1带参数形式,这是页面之间比较主要的传值方式 ,用request,get 接收值.
from表单传值 : 主要接收request传值 post, get  来接收,from标签可以选择get或者post 通过url传值的是get 还可以利用ajax传值可以选择post或者get.

session传值 : 这个一般是做用户登陆时用的,服务器全局变量,一般不用在页面之前的传值
cookie传值 :把内容保存在客户端,

我们常用的页面传值主要是参数传值  from表单传值传值。

现在来做几个实例
*/
//先用页面参数传值实例

?>

点击我
//输出值为 1

用form传值

 

 

得出值 5

 

 



if( $_GET )
{
 echo 'get传值',$_GET['action'];
}
else
{
 echo 'post传值', $_POST['action'];
}
//本文章原创于www.111cn.net 中国WEB第一站,,转载注明出处

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