PHP四种传参方式
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四种传参方式的更多相关文章
- python 计算机发展史,线程Process使用 for循环创建 2种传参方式 jion方法 __main__的解释
########################总结################## #一 操作系统的作用: 1:隐藏丑陋复杂的硬件接口,提供良好的抽象接口 2:管理.调度进程,并且将多个进程对硬 ...
- Vue中router两种传参方式
Vue中router两种传参方式 1.Vue中router使用query传参 相关Html: <!DOCTYPE html> <html lang="en"> ...
- axios的各种传参方式
axios的各种传参方式 1. params方式 axios({ url: '/users', method: 'get', params: { id: '11111', name: '22222' ...
- vue param和query两种传参方式
1.传参方式 query传参方式 this.$router.push({ path: "/home", query: {code:"123"} }) param ...
- 浅谈C++三种传参方式
浅谈C++三种传参方式 C++给函数传参中,主要有三种方式:分别是值传递.指针传递和引用传递. 下面通过讲解和实例来说明三种方式的区别. 值传递 我们都知道,在函数定义括号中的参数是形参,是给函数内专 ...
- Mybatis的几种传参方式,你了解吗?
持续原创输出,点击上方蓝字关注我 目录 前言 单个参数 多个参数 使用索引[不推荐] 使用@Param 使用Map POJO[推荐] List传参 数组传参 总结 前言 前几天恰好面试一个应届生,问了 ...
- 四:flask-URL两种传参方式(路径传参和get传参)
新建一个视图 第一种:路径传参:url/参数:<参数名>,然后再视图函数中接收参数 也可以指定数据类型 string:默认使用此数据类型,接收没有任何斜杠"\/"的文本 ...
- vector作为参数的三种传参方式
c++中常用的vector容器作为参数时,有三种传参方式,分别如下(为说明问题,用二维vector): function1(std::vector<std::vector<int> ...
- vue的三种传参方式
<template> <div> <router-link :to="{'name':'x',params:{'type':'users'}}"> ...
随机推荐
- 12.URL重写
为什么要URL重写?1.有利于SEO(搜索引擎优化),带参数的RUL权重较低.2.地址看起来更正规,推广uid. 如我们一般在访问网页是会带参数,http://aaa.com/view.htm?id= ...
- 在JNI中新开线程遇到问题
08-03 13:39:30.535 1663-20490/system_process E/RfidReaderService﹕ input RDID CARD ID g_data: ...
- 【转】BCSphere入门教程01:Immediate Alert--不错
原文网址:http://www.ituring.com.cn/article/117570 写在前面 智能硬件开发的起点是智能硬件,在本教程中的每一章节,首先会列出您的蓝牙智能硬件所需要支持的Serv ...
- C# Protect the Password inside a TextBox ZZ
If the Text property is called, it will send an WM_GETTEXT message, so it will surely be an internal ...
- [SDJX2015]面积
[问题描述:] 一个六边形的每个内角均为120°,按顺时针给定它每条边的长度,求它的面积与边长为1的等边三角形的面积的比值. [输入:] 一行六个整数a,b,c,d,e,f,表示六条边的长度. [输出 ...
- ZOJ Problem Set - 1025解题报告
ZOJ Problem Set - 1025 题目分类:基础题 原题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=10 ...
- codeforces 358D
题目链接:http://codeforces.com/contest/358/problem/D #include<cstdio> #include<iostream> #in ...
- 天津Uber优步司机奖励政策(1月25日~1月31日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- hdoj 2074 叠筐
叠筐 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submissi ...
- C程序设计语言--宏定义
C语言中的宏定义 C语言中的宏定义也叫做预处理命令,预处理命令是C语言本身的组成部分,不能直接对它们进行编译. 1.基本概念: 1>预处理不是C语句,是在编译前进行的 2>预处理功能主要用 ...