php跨页面的三种传值方式

不言
Lepaskan: 2023-03-23 07:52:02
asal
6644 orang telah melayarinya
<p class="htmledit_views">本篇文章的内容是php跨页面的三种传值方式 ,现在在这里分享给大家,也可以给有需要的朋友一个参考</p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">      一. POST传值</p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">      post传值是用于html的<form>表单跳转的方法,很方便使用。例如:</p> <p style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:'微软雅黑', Verdana, sans-serif, '宋体';font-size:13px;background-color:rgb(255,255,255);"><br></p> <p class="syntaxhighlighter html" style="padding:0px;margin:1em 0px;font-size:1em;"><br></p> <p class="toolbar" style="margin:0px;padding:0px;border:none;float:none;line-height:1.1em;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:10px;color:rgb(255,255,255);background-color:rgb(108,226,108);"><span style="margin:0px;padding:0px;">?</span></p> <table border="0" style="margin:0px;padding:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><tbody style="padding:0px;margin:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><tr style="border-top:0px;padding:0px;margin:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;" class="firstRow"> <td class="gutter" style="border-width:0px;font-size:1em;color:rgb(175,175,175);line-height:1.1em;padding:0px;margin:0px;float:none;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"> <p class="line number1 index0 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">1</p> <p class="line number2 index1 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">2</p> <p class="line number3 index2 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">3</p> <p class="line number4 index3 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">4</p> <p class="line number5 index4 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">5</p> <p class="line number6 index5 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">6</p> <p class="line number7 index6 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">7</p> </td> <td class="code" style="border-width:0px;font-size:1em;line-height:1.1em;padding:0px;margin:0px;float:none;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"> <p class="container" style="margin:0px;padding:0px;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><br></p> <p class="line number1 index0 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="html spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"><</code><code class="html keyword" style="color:rgb(0,102,153);padding:0px;font-size:1em;margin:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;float:none;vertical-align:baseline;font-weight:bold;">html</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">></code></p> <p class="line number2 index1 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="html spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"><</code><code class="html keyword" style="color:rgb(0,102,153);padding:0px;font-size:1em;margin:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;float:none;vertical-align:baseline;font-weight:bold;">form</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">action</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;&#39;</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">method</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;&#39;</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">></code></p> <p class="line number3 index2 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="html spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"><</code><code class="html keyword" style="color:rgb(0,102,153);padding:0px;font-size:1em;margin:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;float:none;vertical-align:baseline;font-weight:bold;">input</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">type</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;text&#39;</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">name</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;name1&#39;</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">></code></p> <p class="line number4 index3 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="html spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"><</code><code class="html keyword" style="color:rgb(0,102,153);padding:0px;font-size:1em;margin:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;float:none;vertical-align:baseline;font-weight:bold;">input</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">type</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;hidden&#39;</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">name</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;name2&#39;</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">value</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;value&#39;</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">></code></p> <p class="line number5 index4 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="html spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"><</code><code class="html keyword" style="color:rgb(0,102,153);padding:0px;font-size:1em;margin:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;float:none;vertical-align:baseline;font-weight:bold;">input</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">type</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;submit&#39;</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">value</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;提交&#39;</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">></code></p> <p class="line number6 index5 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="html spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"></</code><code class="html keyword" style="color:rgb(0,102,153);padding:0px;font-size:1em;margin:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;float:none;vertical-align:baseline;font-weight:bold;">form</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">></code></p> <p class="line number7 index6 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="html spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"></</code><code class="html keyword" style="color:rgb(0,102,153);padding:0px;font-size:1em;margin:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;float:none;vertical-align:baseline;font-weight:bold;">html</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">></code></p> </td> </tr></tbody></table> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;"><br></p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">      form中的action填入的是跳转页面的url路径,method填入post方法。form表单中的提交按钮按下后,就会把form中有name的内容都传到填入的url中,可以通过$_POST['name']获取,例如:</p> <p style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:'微软雅黑', Verdana, sans-serif, '宋体';font-size:13px;background-color:rgb(255,255,255);"><br></p> <p class="syntaxhighlighter php" style="padding:0px;margin:1em 0px;font-size:1em;"><br></p> <p class="toolbar" style="margin:0px;padding:0px;border:none;float:none;line-height:1.1em;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:10px;color:rgb(255,255,255);background-color:rgb(108,226,108);"><span style="margin:0px;padding:0px;">?</span></p> <table border="0" style="margin:0px;padding:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><tbody style="padding:0px;margin:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><tr style="border-top:0px;padding:0px;margin:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;" class="firstRow"> <td class="gutter" style="border-width:0px;font-size:1em;color:rgb(175,175,175);line-height:1.1em;padding:0px;margin:0px;float:none;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"> <p class="line number1 index0 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">1</p> <p class="line number2 index1 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">2</p> <p class="line number3 index2 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">3</p> <p class="line number4 index3 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">4</p> </td> <td class="code" style="border-width:0px;font-size:1em;line-height:1.1em;padding:0px;margin:0px;float:none;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"> <p class="container" style="margin:0px;padding:0px;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><br></p> <p class="line number1 index0 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"><?php</code></p><p class="line number2 index1 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php variable" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(170,119,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">$a</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="php variable" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(170,119,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">$_POST</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">[</code><code class="php string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;name1&#39;</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">];</code></p><p class="line number3 index2 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php variable" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(170,119,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">$b</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="php variable" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(170,119,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">$_POST</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">[</code><code class="php string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;name2&#39;</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">];</code></p><p class="line number4 index3 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">?></code></p> </td> </tr></tbody></table> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;"><br></p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">      这里有个很方便的小技巧,在input标签中把type选为'hidden'时,这个input标签会隐藏起来,不在页面显示,但这input标签在form中,并且有name值和value值,同样会跟随提交按钮传递过去,这种隐藏标签可以传递一些不想显示出来的内容。</p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">    二.GET传值</p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">     GET传值是通过跟随url传递的,在页面跳转时,跟着url跳转。常用于<a>标签的使用。例如:</p> <p style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:'微软雅黑', Verdana, sans-serif, '宋体';font-size:13px;background-color:rgb(255,255,255);"><br></p> <p class="syntaxhighlighter html" style="padding:0px;margin:1em 0px;font-size:1em;"><br></p> <p class="toolbar" style="margin:0px;padding:0px;border:none;float:none;line-height:1.1em;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:10px;color:rgb(255,255,255);background-color:rgb(108,226,108);"><span style="margin:0px;padding:0px;">?</span></p> <table border="0" style="margin:0px;padding:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><tbody style="padding:0px;margin:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><tr style="border-top:0px;padding:0px;margin:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;" class="firstRow"> <td class="gutter" style="border-width:0px;font-size:1em;color:rgb(175,175,175);line-height:1.1em;padding:0px;margin:0px;float:none;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"><p class="line number1 index0 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">1</p></td> <td class="code" style="border-width:0px;font-size:1em;line-height:1.1em;padding:0px;margin:0px;float:none;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"> <p class="container" style="margin:0px;padding:0px;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><br></p> <p class="line number1 index0 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"><</code><code class="html keyword" style="color:rgb(0,102,153);padding:0px;font-size:1em;margin:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;float:none;vertical-align:baseline;font-weight:bold;">a</code> <code class="html color1" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">href</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">=</code><code class="html string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;delete.php?id=value&#39;</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">>点我跳转</</code><code class="html keyword" style="color:rgb(0,102,153);padding:0px;font-size:1em;margin:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;float:none;vertical-align:baseline;font-weight:bold;">a</code><code class="html plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">></code></p> </td> </tr></tbody></table> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;"><br></p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">   跳转进入xxx.php后,就能通过$_GET['id']获取传递的值。GET方法常用于URL的目的是删除或读取某个id的php文件。</p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">   三.SESSION传值</p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">   SESSION是全局变量的一种,经常用于用户登陆后保存用户id之类的常用数据。一旦保存到SESSION中,其他页面都可以通过SESSION获取,SESSION的使用要开启session:</p> <p style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:'微软雅黑', Verdana, sans-serif, '宋体';font-size:13px;background-color:rgb(255,255,255);"><br></p> <p class="syntaxhighlighter php" style="padding:0px;margin:1em 0px;font-size:1em;"><br></p> <p class="toolbar" style="margin:0px;padding:0px;border:none;float:none;line-height:1.1em;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:10px;color:rgb(255,255,255);background-color:rgb(108,226,108);"><span style="margin:0px;padding:0px;">?</span></p> <table border="0" style="margin:0px;padding:0px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><tbody style="padding:0px;margin:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><tr style="border-top:0px;padding:0px;margin:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;" class="firstRow"> <td class="gutter" style="border-width:0px;font-size:1em;color:rgb(175,175,175);line-height:1.1em;padding:0px;margin:0px;float:none;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"> <p class="line number1 index0 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">1</p> <p class="line number2 index1 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">2</p> <p class="line number3 index2 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">3</p> <p class="line number4 index3 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">4</p> <p class="line number5 index4 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">5</p> <p class="line number6 index5 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">6</p> <p class="line number7 index6 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">7</p> <p class="line number8 index7 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">8</p> <p class="line number9 index8 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">9</p> <p class="line number10 index9 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">10</p> <p class="line number11 index10 alt2" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">11</p> <p class="line number12 index11 alt1" style="margin:0px;padding:0px .5em 0px 1em;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;line-height:1.1em;text-align:right;vertical-align:baseline;font-size:1em;white-space:pre;">12</p> </td> <td class="code" style="border-width:0px;font-size:1em;line-height:1.1em;padding:0px;margin:0px;float:none;vertical-align:baseline;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"> <p class="container" style="margin:0px;padding:0px;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;"><br></p> <p class="line number1 index0 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"><?php</code></p><p class="line number2 index1 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php comments" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,130,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">//session赋值</code></p><p class="line number3 index2 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">session_start();</code></p><p class="line number4 index3 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="php variable" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(170,119,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">$_SESSION</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">[</code><code class="php string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;one&#39;</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">]=value1;</code></p><p class="line number5 index4 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="php variable" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(170,119,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">$_SESSION</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">[</code><code class="php string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;two&#39;</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">]=value2;</code></p><p class="line number6 index5 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"> </p><p class="line number7 index6 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php comments" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,130,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">//session值的读取:</code></p><p class="line number8 index7 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="php variable" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(170,119,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">$one</code> <code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">= </code><code class="php variable" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(170,119,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">$_SESSION</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">[</code><code class="php string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;one&#39;</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">];</code></p><p class="line number9 index8 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code> </p><p class="line number10 index9 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="php comments" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,130,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">//session值的销毁</code></p><p class="line number11 index10 alt2" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php spaces" style="color:rgb(64,170,83);font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;"> </code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">unset(</code><code class="php variable" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(170,119,0);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">$_SESSION</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">[</code><code class="php string" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;color:rgb(0,0,255);padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">&#39;one&#39;</code><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">]);</code></p><p class="line number12 index11 alt1" style="margin:0px;padding:0px 1em;border:0px;float:none;line-height:1.1em;vertical-align:baseline;font-size:1em;white-space:pre;"><code class="php plain" style="font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-size:1em;line-height:1.1em;padding:0px;margin:0px;border:0px;float:none;vertical-align:baseline;">?></code></p> </td> </tr></tbody></table> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;"><br></p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">   以上三种方式是常用方式,大家可以参考使用。</p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">对于三种方式的利弊,get传值是显示在URL链接中,很不安全,如果是要链接到另一页面,post不太方便使用,选择session是一个很好很方便的方法</p> <p style="margin-top:8px;margin-bottom:8px;font-size:12.5px;font-family:'微软雅黑', Verdana, sans-serif, '宋体';background-color:rgb(255,255,255);letter-spacing:.5px;">。<img src="https://img.php.cn/upload/article/000/153/291/9d327346da59a8eb93e1a2f9f28b3f63-0.png" alt=""></p> <p style="margin-top: 8px; margin-bottom: 8px; font-size: 12.5px; font-family: 微软雅黑, Verdana, sans-serif, 宋体; background-color: rgb(255, 255, 255); letter-spacing: 0.5px;"><img src="https://img.php.cn/upload/article/000/153/291/9d327346da59a8eb93e1a2f9f28b3f63-1.jpg" alt=""></p> <p style="margin-top: 8px; margin-bottom: 8px; font-size: 12.5px; font-family: 微软雅黑, Verdana, sans-serif, 宋体; background-color: rgb(255, 255, 255); letter-spacing: 0.5px;">相关推荐:</p> <p style="margin-top: 8px; margin-bottom: 8px; font-size: 12.5px; font-family: 微软雅黑, Verdana, sans-serif, 宋体; background-color: rgb(255, 255, 255); letter-spacing: 0.5px;"><a href="http://www.php.cn/php-weizijiaocheng-388417.html" target="_self">php传值与传引用区别详解</a></p> <p style="margin-top: 8px; margin-bottom: 8px; font-size: 12.5px; font-family: 微软雅黑, Verdana, sans-serif, 宋体; background-color: rgb(255, 255, 255); letter-spacing: 0.5px;"><br></p>

Atas ialah kandungan terperinci php跨页面的三种传值方式 . Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Artikel terbaru oleh pengarang
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan