クッキーの例え
このコミットが含まれているのは:
コミット
e22731c8ce
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
function getcookie (string $name): array {
|
||||
function getcookie (string $name): string {
|
||||
return htmlspecialchars($_COOKIE[$name]);
|
||||
}
|
||||
|
||||
function getrawcookie (string $name): array {
|
||||
function getrawcookie (string $name): string {
|
||||
return $_COOKIE[$name];
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
if (isset($_POST['lolicon_cookie'])) {
|
||||
// 2時間後消えられます。
|
||||
setcookie('lolicon_cookie', $_POST['lolicon_cookie'], ['expires' => time()+60*60*2, 'path' => '/cookie', 'httponly' => true]);
|
||||
//setrawcookie('lolicon_cookie', $_POST['lolicon_cookie'], ['expires' => time()+60*60*2, 'path' => '/cookie', 'httponly' => true]);
|
||||
header('Location: /cookie', 301);
|
||||
}
|
||||
|
||||
$title = 'クッキー'; // 必須・Requirement
|
||||
$sitedesc = 'クッキーの例え'; // config.phpの文字の交換・Change character of config.php
|
||||
$siteurl .= '/cookie'; // config.phpの文字に追加・Add to character of config.php
|
||||
$childview = '../ui/cookie/index.php'; // 必須・Requirement
|
||||
$mycookie = getcookie('lolicon_cookie');
|
||||
//$mycookie = getrawcookie('lolicon_cookie');
|
||||
?>
|
|
@ -0,0 +1,9 @@
|
|||
setcookie
|
||||
<form method="POST" action="/cookie">
|
||||
<input type="text" name="lolicon_cookie" />
|
||||
<input type="submit" value="送信" />
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
getcookie
|
||||
<?php echo $mycookie; ?>
|
読み込み中…
新しいイシューから参照