Welcome Guest, Not a member yet? Register   Sign In
trying to run function just once
#21

(06-23-2021, 02:07 PM)richb201 Wrote: Thanks Beer. I moved the function into index.php (the one in my controller) and this seemed to take care of it since this is not connected to __construct or _init, which I know now runs on every page load. Do you think I still need to watch to see it it was already initialized?

A PHP web application starts from scratch at every page load. It's not a program that keeps running. Unless you save the data in the session, in a cookie or in the database, nothing is retained in memory. Each page load is a new process and it doesn't know what happened before. So, yes you need to watch if you already download the file if you want to do it only once per session. The right place to do this would be right after a successful login. You know this is done only once, so in this case you don't need to keep track if the file was already downloaded.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#22

my advice gose to move to ci 4
Enlightenment  Is  Freedom
Reply




Theme © iAndrew 2016 - Forum software by © MyBB