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. google python/c++ code style naming

    python: Guidelines derived from Guido's Recommendations Type Public Internal Packages lower_with_und ...

  2. 开始hadoop

    hadoop介绍 分布式存储系统HDFS(Hadoop Distributed File System),提供了高可靠性.高扩展性和高吞吐率的数据存储服务: 资源管理系统YARN(Yet Anothe ...

  3. ServiceModel Metadata Utility Tool (Svcutil.exe)

    https://msdn.microsoft.com/zh-cn/library/aa347733.aspx 参数: /directory:<directory> Directory to ...

  4. Codevs_1230_元素查找_(set/Hash)

    描述 http://codevs.cn/problem/1230/ ... 1230 元素查找 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond       题目 ...

  5. POJ_3046_Ant_Counting_(动态规划,多重集组合数)

    描述 http://poj.org/problem?id=3046 n种蚂蚁,第i种有ai个,不同种类的蚂蚁可以相互区分,但同一种类的蚂蚁不能相互区分,从这些蚂蚁中取出s,s+1,s+2,...,b- ...

  6. Firebug控制台详解

    转自:http://www.ruanyifeng.com/blog/2011/03/firebug_console_tutorial.html 作者: 阮一峰 日期: 2011年3月26日 Fireb ...

  7. HDU 2602 Bone Collector

    http://acm.hdu.edu.cn/showproblem.php?pid=2602 Bone Collector Time Limit: 2000/1000 MS (Java/Others) ...

  8. JavaScript高级程序设计52.pdf

    表单脚本 表单的基础知识 在HTML中,表单是由<form>元素表示的,在Javascript对应的是HTMLFormElement类型,它继承自HTMLElement,因此具有与其他HT ...

  9. python爬虫学习(1)__抓取煎蛋图片

    #coding=utf-8 #python_demo 爬取煎蛋妹子图在本地文件夹 import requests import threading import time import os from ...

  10. 1 weekend110的hdfs源码跟踪之打开输入流 + hdfs源码跟踪之打开输入流总结

    3种形式的元数据,fsimage是在磁盘上,meta.data是在内存上, 我们继续,前面呢,断点是打在这一行代码处, FileSystem fs = FileSystem.get(conf); we ...