test1界面:

<html>
<head>
<title>testPHP</title> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> </head>
<body>
<?php //第一种设置传参方式,通过cookie
setcookie('my','yefeng'); //第二种传参方式,通过设置服务器session值传递参数
session_start();
$_SESSION["temp"] = array('456','789'); $test = "我是一个测试变量"; ?> <div id = "test1" style = "height:10%; border:1px solid red">
//第一种传参方式
</div> <div id = "test2" style = "height:10%; border:1px solid red; margin-top:5%">
//第二种传参方式
</div> <div id = "test3" style = "height:10%; border:1px solid red; margin-top:5%">
//第三种传参方式
<form action = "test2.php" method = "post"> <input type = "text" name = "my"/> <input type = "submit" name = "submit" value = "提交" /> </form>
</div> <div id = "test4" style = " height:10%; border:1px solid red; margin-top:5%">
<a href = "<?php echo"test2.php?urlValue=".$test4?>">
第四种传参方式
</a>
</div> </body>
</html>

test2界面:

<html>
<head>
<meta charset = 'utf-8' /> <?php $test = $_COOKIE['my']; echo $test;
echo '<br/>';
session_start(); for($i = 0; $i < 2; $i ++){ echo $_SESSION['temp'][$i].'<br/>';
} $testForm = $_POST['my']; echo "表单参数传递".$testForm; echo "第四种传参值".$_GET['urlValue']; ?> </head>
<body></body>
</html>

PHP四种传参方式的更多相关文章

  1. python 计算机发展史,线程Process使用 for循环创建 2种传参方式 jion方法 __main__的解释

    ########################总结################## #一 操作系统的作用: 1:隐藏丑陋复杂的硬件接口,提供良好的抽象接口 2:管理.调度进程,并且将多个进程对硬 ...

  2. Vue中router两种传参方式

    Vue中router两种传参方式 1.Vue中router使用query传参 相关Html: <!DOCTYPE html> <html lang="en"> ...

  3. axios的各种传参方式

    axios的各种传参方式 1. params方式 axios({ url: '/users', method: 'get', params: { id: '11111', name: '22222' ...

  4. vue param和query两种传参方式

    1.传参方式 query传参方式 this.$router.push({ path: "/home", query: {code:"123"} }) param ...

  5. 浅谈C++三种传参方式

    浅谈C++三种传参方式 C++给函数传参中,主要有三种方式:分别是值传递.指针传递和引用传递. 下面通过讲解和实例来说明三种方式的区别. 值传递 我们都知道,在函数定义括号中的参数是形参,是给函数内专 ...

  6. Mybatis的几种传参方式,你了解吗?

    持续原创输出,点击上方蓝字关注我 目录 前言 单个参数 多个参数 使用索引[不推荐] 使用@Param 使用Map POJO[推荐] List传参 数组传参 总结 前言 前几天恰好面试一个应届生,问了 ...

  7. 四:flask-URL两种传参方式(路径传参和get传参)

    新建一个视图 第一种:路径传参:url/参数:<参数名>,然后再视图函数中接收参数 也可以指定数据类型 string:默认使用此数据类型,接收没有任何斜杠"\/"的文本 ...

  8. vector作为参数的三种传参方式

    c++中常用的vector容器作为参数时,有三种传参方式,分别如下(为说明问题,用二维vector): function1(std::vector<std::vector<int> ...

  9. vue的三种传参方式

    <template> <div> <router-link :to="{'name':'x',params:{'type':'users'}}"> ...

随机推荐

  1. Text Reverse

    Text Reverse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

  2. ftp服务器测试

    前台传递字符串reqbuf: ftp服务器IP\r\n端口\r\n用户名\r\n密码\r\nftp路径\r\n\r\n 解析reqbuf,重新组装成系统命令,去执行ftptest.sh脚本, 调用sy ...

  3. KEIL、uVision、RealView、MDK、KEIL C51区别比较

    KEIL uVision,KEIL MDK,KEIL For ARM,RealView MDK,KEIL C51,KEIL C166,KEIL C251 从接触MCS-51单片机开始,我们就知道有一个 ...

  4. 关于理解《C++ 对象模型》中:把单一元素的数组放在末尾,struct可以拥有可变大小的数组

    这一章在第19页,写的好深奥,我竟然没看明白在说什么--之后再看了几遍,终于明白了. 原文: C程序员的巧计有时候却成为c++程序员的陷阱.例如把单一元素的数组放在一个struct的末尾,于是每个st ...

  5. ARM学习日记

    2012-05-15 1.ARM开发板环境的搭建,nor启动,通过suppervivi,下载vivi---下载Kernel----下载文件系统,然后Nandflash启动即可. 2.在/etc/ini ...

  6. msm8610 lcd driver code analysis

    ---恢复内容开始--- 1  lcd probe The probe sequence is determined by compilation sequence: mdss-mdp3-objs = ...

  7. Project Euler 9

    题意:三个正整数a + b + c = 1000,a*a + b*b = c*c.求a*b*c. 解法:可以暴力枚举,但是也有数学方法. 首先,a,b,c中肯定有至少一个为偶数,否则和不可能为以上两个 ...

  8. LR(1)表生成算法演示程序

    /* * LR 转换表 * + Goto 记录表 * + 状态转换表 */ #include <stdio.h> #include <stdlib.h> #include &l ...

  9. The File's Owner

    The File Owner is an instantiated, runtime object that owns the contents of your nib and its outlets ...

  10. [转]在MacOS和iOS系统中使用OpenCV

    OpenCV 是一个开源的跨平台计算机视觉库,实现了图像处理和计算机视觉方面的很多通用算法. 最近试着在MacOS和iOS上使用OpenCV,发现网上关于在MacOS和iOS上搭建OpenCV的资料很 ...