PHP會話處理相關函數介紹【上】

來源:互聯網
上載者:User
PHP處理會話函數1、 session_start函數功能:開始一個會話或者返回已經存在的會話。函數原型:boolean session_start(void);傳回值:布爾值功能說明:這個函數沒有參數,且傳回值均為true。最好將這個函數置於最先,而且在它之前不能有任何輸出,否則會警示,如:Warning: Cannot send session cache limiter – headers already sent (output started at/usr/local/apache/htdocs/cga/member/1.php:2) in/usr/local/apache/htdocs/cga/member/1.php on line 3 PHP處理會話函數2、 session_register函數功能:登記一個新的變數為會話變數函數原型:boolean session_register(string name);傳回值:布爾值。功能說明:這個函數是在全域變數中增加一個變數到當前的SESSION中,參數name就是想要加入的變數名,成功則返回邏輯值true。可以用$_SESSION[name]或$HTTP_SESSION_VARS[name]的形式來取值或賦值。 PHP處理會話函數3、 session_is_registered函數功能:檢查變數是否被登記為會話變數。函數原型:boobean session_is_registered(string name);傳回值:布爾值功能說明:這個函數可檢查當前的session之中是否已有指定的變數註冊,參數name就是要檢查的變數名。成功則返回邏輯值true。 PHP處理會話函數4、 session_unregister函數功能:刪除登入的變數。函數原型:boolean session_session_unregister(stringname);傳回值:布爾值功能說明:這個函數在當前的session之中刪除全域變數中的變數。參數name就是欲刪除的變數名,成功則返回true。 PHP處理會話函數5、session_destroy函數功能:結束當前的會話,並清空會話中的所有資源。函數原型:boolean session destroy(void);傳回值:布爾值。功能說明:這個函數結束當前的session,此函數沒有參數,且傳回值均為true。
免費領取LAMP兄弟連原創php教程光碟片/《細說PHP》精要版,詳情諮詢官網客服:http://www.lampbrother.netPHPCMS二次開發 http://yun.itxdl.cn/online/phpcms/index.php?u=5開發 http://yun.itxdl.cn/online/weixin/index.php?u=5移動互連網伺服器端開發 http://yun.itxdl.cn/online/server/index.php?u=5Javascript課程 http://yun.itxdl.cn/online/js/index.php?u=5CTO訓練營 http://yun.itxdl.cn/online/cto/index.php?u=5
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.