当前位置: 首页 > article >正文

php中 session start,php中session_start()的具体解释

kuailianji201的答复:

刚刚

session_start(PHP 4, PHP 5)session_start — Initialize session data说明bool session_start ( void )session_start() creates a session or resumes the current one based on the current session id that's being passed via a request, such as GET, POST, or a cookie. If you want to use a named session, you must call session_name() before calling session_start(). session_start() will register internal output handler for URL rewriting when trans-sid is enabled. If a user uses ob_gzhandler or like with ob_start(), the order of output handler is important for proper output. For example, user must register ob_gzhandler before session start. 返回值This function always returns TRUE. 更新日志版本 说明 4.3.3 As of now, calling session_start() while the session has already been started will result in an error of level E_NOTICE. Also, the second session start will simply be ignored.  范例例 2126. A session example: page1.php<?php // page1.phpsession_start();echo 'Welcome to page #1';$_SESSION['favcolor'] = 'green';$_SESSION['animal']   = 'cat';$_SESSION['time']     = time();// Works if session cookie was acceptedecho '
page 2';// Or maybe pass along the session id, if neededecho 'page 2';?> After viewing page1.php, the second page page2.php will magically contain the session data. Read the session reference for information on propagating session ids as it, for example, explains what the constant SID is all about. 例 2127. A session example: page2.php<?php // page2.phpsession_start();echo 'Welcome to page #2
';echo $_SESSION['favcolor']; // greenecho $_SESSION['animal'];   // catecho date('Y m d H:i:s', $_SESSION['time']);// You may want to use SID here, like we did in page1.phpecho 'page 1';?> 注释注意: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.

http://www.lryc.cn/news/2418533.html

相关文章:

  • Flappy Bird成名记:28天令人咋舌却真实的故事
  • 用Java实现文本编辑器
  • highdefinitionaudio驱动感叹号_High Definition Audio
  • HBuilder的下载与使用(详细步骤)
  • linux les命令,Linux用户和组命令
  • [转]CMS Content Management System(内容管理系统) 提供商
  • 【jsp+servelet】JSTL c:out使用 escapeXml 属性保持 HTML 格式编排
  • 12306可免费送人进站,接人出站!无需购票即可送至站台、车厢
  • bootstrap fileupload插件实现文件上传与前端回显图片
  • EI检索入口查询方法
  • magent java_bt种子简介与magnet磁力介绍
  • 毕业设计:基于java的出租车计价器系统设计与实现
  • This failure was cached in the local repository and resolution is not reattempted until the update
  • 前端中--js定时器的用法SetTimeout
  • Web窗体的基本控件
  • Linux格式化命令
  • weblogic漏洞:CNVD-C-2019-48814
  • 日语
  • 【STM32F042】使用NTC热敏电阻实现温度测量
  • 360手机官方刷机教程(N5系列通用)
  • linux 命令:top 详解
  • 比特率(码率) = 采样率 (Sampling rate ) * 位深 (Bit depth)* 声道数目/Opus/AAC/mp3
  • 人工智能常用的优化算法(梯度下降、牛顿法、拟牛顿法、共轭梯度法、)
  • 奇迹按键精灵挂机脚本_按键精灵做连击脚本(奇迹MU战士用)
  • 计算机专业术语e-mail是什么意思,E-mail是什么意思?
  • msvcrtd.dll下载安装方法是什么?快速修复msvcrtd.dll的手段
  • Windows RC版、RTM版、OEM版、RTL版、VOL版的区别
  • 未能加载文件或程序集“System.Data.SQLite, Version=1.0.84.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139”或它
  • Julia的安装与配置详解(包含在Ubuntu 18
  • [android开发必备]Android开发者社区汇总