passing variable between pages

后端 未结 6 1494
青春惊慌失措
青春惊慌失措 2020-12-22 02:29

Is it good way to pass variable between pages using $_GET method with url:

and take

6条回答
  •  自闭症患者
    2020-12-22 03:11

    You could also use cookies. These are sent like this:

    setcookie(name, value, expire, path, domain);
    

    you can ommit the path and domain variables. This has to be declared before the tag. The name is just the name with which you will get it. The value is what wil be returned and expire is the time at which the cookie expires (it is writen in the form of time() + $timeTillExpire where timetillexpire is a variable or constant value you set). This of course has the limitation of if the person has cookies of it will not work.

    You get a cookie with:

    $_COOKIE["name"];
    

    and returns value

    the way you did works fine.

提交回复
热议问题