Closing a conneciton in the “unload” method

前端 未结 5 1059
故里飘歌
故里飘歌 2021-01-18 15:31

I have inherited a web framework whereby the previous developer has opened and closed his database connections in the init/unload methods of the page life cycle. Essentially

5条回答
  •  走了就别回头了
    2021-01-18 15:38

    No. Take the following example.

    What happens if the user closes the browser? The Unload function will then not be called and you will have an open connection to the database.

    This Unload question on StackOverflow has a similar problem that you are having.

提交回复
热议问题