Store app global variable |
Hello,
Is there a solution to store a global dynamic variable for all my app without database ? For exemple : a token for API. It's generate just one time by the app, and it can be use by all controllers Thanks for your returns
@FlorianL,
Yes, you could use session variables (https://codeigniter.com/user_guide/libra...ssion-data). (04-26-2021, 07:11 AM)php_rocs Wrote: @FlorianL,Hi php_rocs, Thanks for your reply. Session aren't global for my application but only for my client. For example : i init an API connexion with an auth processus on the website The end of this processus give me a token I want to store this token for all users on my website can use it to interact with the API. Database is a solution but i think it's not the right to use-it only for store one or two variables
Use a shared database to store it.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Try saving a file to the writable folder and allow the file contents to be changed. This would make the variable file contents dynamic. The file name could be an index.php defined constant.
Jwt token its good choice
I used and work vwry well First generate jwt token then getbtoken as header authentication finally use filter to validate token if expire or not Search jwt token for ci4
Enlightenment Is Freedom
You want Cache. If you set TTL (time to live) to 0 it will persist until overwritten or explicitly deleted, though likely if you are receiving an Auth token it will already have its own expiration associated.
|
Welcome Guest, Not a member yet? Register Sign In |