dongxia527680 2012-09-15 14:24
浏览 57

如何在构建REST API时管理CakePHP中的会话启动?

I have read this post earlier: Generally splitting admin and web app into two entities

Basically the gist of it is that we can combine the api side of things and the web front side of things together in one cakephp app. However, as you know REST is stateless and there is no reason to expect the client to keep a cookie or anything like that. Do you guys know when exactly does the session_start function gets trigger in CakePHP? I really want to avoid the running session_start when my API end points are hit. However, I will need session to start when my regular web fronts are hit.

  • 写回答

2条回答 默认 最新

  • doulai5585 2013-01-17 08:09
    关注

    session_start() gets triggered in CORE\Cake\Model\Datasource\CakeSession.php. if you do not want to trigger the session_start(), be sure to not include the session component or helper in your controller. Also, be sure not to call session or use Auth component, as it also can automagically trigger session_start() in some cases.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?