Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
たとえば、ユーザーがテキストフォームを使用して変数を設定できるようにし、フォームに入力し$nameた後にCookieを設定したいので、Cookieはに設定され$nameます。
$name
したがって、テキスト形式の場合、ユーザーは$name = 'John';
$name = 'John';
次に、Cookieをsetcookie ("name", "John");に設定します。
setcookie ("name", "John")
ありがとう!
次のコード
setcookie('name',$_GET['name']);
するべきです。
$name = $_REQUEST['name']; if(!isset($_COOKIE['name'])) { setcookie('name',$name,0);//The cookie will expire at the end of the session }