php session_start with include files

后端 未结 5 1160
遇见更好的自我
遇见更好的自我 2020-12-06 17:03

i learned a lot about session start from my previous question. Now i\'m wondering how session locking occurs when files are included in other files. Lets say i have:

5条回答
  •  Happy的楠姐
    2020-12-06 17:55

    1. You should start session only one time. In your example, just need session_start() at the first line of page.php
    2. session_start() will generate E_NOTICE if session was previously started. You can use @session_start() to ignore it.
    3. It also generates E_NOTICE if you use session_start() after you output HTML code.

提交回复
热议问题