Results 1 to 4 of 4

Thread: Double Dependency Injection?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    What you try is not possible with PHP, the interpreter is basically resetted for every page request. That's why you need to reinitialize the needed data at every page request via new database queries.

    When you need "sticky" variables, you could try node.js http server. The interpreter isn't "detached" behind by e.g. a FastCGI wall from the web server.

    For PHP, just make a table relation between the $_COOKIE["PHPSESSID"] and the stuff you want to cache (e.g. which groups the user belongs to). Normally tho you just save the most important stuff like the session expiration time of the session and the user id, so the home.php has a way to know that the user is logged in via checking the cookie session ID against the session table.

    You are welcome ^^
    timescale 0.01

  2. The Following User Says Thank You to kung foo man For This Useful Post:

    Whiskas (20th November 2016)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •