Home  >  Q&A  >  body text

每次使用session都要start()一下吗?

每次使用session都要start()一下吗?

phpcn_u226phpcn_u2262832 days ago1403

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-09-30 23:04:01

    Do I need to start() every time I use the session? -PHP Chinese website Q&A-Do I need to start() every time I use the session? -PHP Chinese website Q&A

    Please watch and learn.

    reply
    0
  • 阿神

    阿神2016-12-20 11:09:40

    如果需要读写 session 就需要在没有任何输出的情况下执行 session_start(); 

    如果觉得这样不太方便,可以直接在php.ini将
    session.auto_start = 0
    改成
    session.auto_start = 1

    这样就不需要每次使用session再执行 session_start();

    reply
    0
  • Cancelreply