推薦:解析PHP網(wǎng)站開發(fā)中常見的問題【1】頁面之間無法傳遞變量
get,post,session在最新的php版本中自動全局變量是關(guān)閉的,所以要從上一頁面取得提交過來得變量要使用_GET['foo'],_POST['foo'],_SESSION['foo']來得到
| 以下為引用的內(nèi)容:
<?
.....
.....
//顯示分類************************************************
if (func=='showtype'):
echo "<table>";
//判斷分類的狀態(tài)
if (uid!=0) {
result=mysql_query("select * from type where id=uid");
type=mysql_result(result,0,"type");
//******** 新加入的代碼 ***************
rout_id=mysql_result(result,0,"rout_id");
rout_char=mysql_result(result,0,"rout_char");
path=explode(":",rout_id);
path_gb=explode(":",rout_char);
echo "<tr><td>";
for (i=0;;i ) {
a=i 1;
echo "<a
href=php_self?func=showtype&uid=",path[a],">",path_gb[i],"</a>:";
if (empty(path_gb[i])) {
break;
}
}
echo "</td></tr>";
//******** end ***********************
} else {
type='父分類';
}
echo "<tr><td><a href='php_self?func=createtype&uid=uid'>創(chuàng)建分類</a></td></tr>";
echo "<tr><td>type</td></tr>";
result=mysql_query("select * from type where uid=uid");
num=mysql_numrows(result);
if (!empty(num)) {
for (i=0;i<num;i ) {
id=mysql_result(result,i,"id");
type=mysql_result(result,i,"type");
echo "<tr><td>";
echo "<a href='php_self?func=showtype&uid=id'>type</a>";
echo "</td></tr>";
}
}
echo "</table>";
endif; /* end showtype */
.....
.....
?>
|
分享:淺析關(guān)于cookie和session1. PHP的COOKIE
cookie 是一種在遠程瀏覽器端儲存數(shù)據(jù)并以此來跟蹤和識別用戶的機制。
PHP在http協(xié)議的頭信息里發(fā)送cookie, 因此 setcookie() 函數(shù)必須在其它信息被輸出到瀏覽器前調(diào)用,