How do I make a unique temporary file to be made for each visitor and store other file pathnames

StackOverflow https://stackoverflow.com/questions/12093686

  •  28-06-2021
  •  | 
  •  

Domanda

Basically I am aware that you can make temporary file (lets call it file2) with the tempnam function in PHP. However, i was wondering how they could automatically be deleted when the user leaves the site. Or even better have that temp file be stored for that user and identified through a cookie.

I manually made a blank text file on which when a user drags an item into a basket that specific pathname for the item is added to the text file however, how do i make this occur for a temporary file which is automatically created when the unique user enters the site. I have a basic template on the site to help grasp your heads around the idea. However, of cource its not functioning properly at the moment as I have left some parts out.

È stato utile?

Soluzione

Why not sessions?

session_start();

$_SESSION['basket'] = "Whatever you like";

php.net/Sessions

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top