php跨頁面的三種傳值方式

不言
發布: 2023-03-23 07:52:02
原創
6615 人瀏覽過
<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>##6<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;"></p>7<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;"></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 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></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 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;"># </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;"></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;"># </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;"></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;"></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 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 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;">輸入</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;">#類型</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;"> </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;"></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>'名稱1'<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;"></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 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 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;">輸入</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;"> </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;"></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>'名稱2'<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;"># </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;"></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;"></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 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 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;">輸入</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;">#類型</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;"># value</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;">=</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;">></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></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;"></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></code></p></code></p></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 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;">'name1'</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;">$b<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;"></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>$_POST<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;"></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>'name2'<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;"></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;">?<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>標籤的使用。例如:</code></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;">'delete.php?id=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 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;">1<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;"></p>2<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;"></p>#3<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;"></p>4<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;"></p>#5<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;"></p>6<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;"></p>7<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;"></p>8<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;"></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;"># #&lt ;?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;">'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;">]=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;">'two'</code>##]=value2;<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 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;">//session值的讀取:<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;"></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>$one<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;"> </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>#$ _SESSION<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;"></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>'one'<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;"></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;">'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></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> </td> </tr></tbody></table>

以上是php跨頁面的三種傳值方式的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!