啟動session session_start(); 釋放所有變數 session_unset(); session_destroy(); //方法一:直接指定 $_SESSION['data'] = "true"; //方法二:使用陣列變數 $_SESSION['phone'] = array(); while( $i = mysql_fetch_assoc($result) ) { $_SESSION['phone'][] = $i['unit'].",".$i['name'].",".$i['ext']; } //讀取陣列變數的方法 foreach($_SESSION['phone'] as $value) { $ar = explode(",",$value); echo $ar[0].$ar[1].$ar[2]; }
沒有留言:
張貼留言