티스토리 뷰
setcookie
setcookie() 는 나머지 HTTP 헤더와 함께 보낼 쿠키를 정의합니다. 다른 헤더와 마찬가지로 쿠키는 스크립트의 출력 보다 먼저 전송되어야 합니다.
setcookie(
string $name,
string $value = "",
int $expires_or_options = 0,
string $path = "",
string $domain = "",
bool $secure = false,
bool $httponly = false
): bool
쿠키에는 중요하지 않은 정보들을 입력해 놓아야 합니다.
클라이언트단에 평문으로 저장되는 정보이기 때문에 사용자가 너무나도 쉽게 위변조가 가능하기 때문입니다.
ex) 팝업창 오늘하루닫아놓기 여부
세션에 저장하는 정보는 서버단에 저장되기 때문에 쿠키보다 안전하므로 사용자 정보는 쿠키가 아닌 세션에 저장해두는 것이 좋습니다.
header(string $header, bool $replace = true, int $response_code = 0): void
일반적인 HTML 태그, 파일의 빈 줄 또는 PHP에서 실제 출력을 보내기 전에 header()를 호출해야 합니다. include , require , functions 또는 다른 파일 액세스 함수 로 코드를 읽고 header() 가 호출 되기 전에 출력되는 공백이나 빈 줄 이 있는 것은 매우 일반적인 오류 입니다. 단일 PHP/HTML 파일을 사용할 때도 동일한 문제가 존재합니다.
잘못된 예
<html>
<?php
/* This will give an error. Note the output
* above, which is before the header() call */
header('Location: http://www.example.com/');
exit;
?>
header_remove(?string $name = null): void
header() 를 사용하여 이전에 설정한 HTTP 헤더를 제거합니다 .
$name은 제거할 헤더 이름입니다. null인 경우 이전에 설정한 모든 헤더가 제거됩니다.
이 매개변수는 대소문자를 구분하지 않습니다.
http_response_code(int $response_code = 0): int|bool
HTTP 응답 상태 코드를 가져오거나 설정합니다.
response_code가 제공된 경우 이전 상태 코드가 반환됩니다. response_code를 제공하지 않으면 현재 상태 코드가 반환됩니다
Network
- Introduction
- Installing/Configuring
- Predefined Constants
- Network Functions
- checkdnsrr — Check DNS records corresponding to a given Internet host name or IP address
- closelog — Close connection to system logger
- dns_check_record — Alias of checkdnsrr
- dns_get_mx — Alias of getmxrr
- dns_get_record — Fetch DNS Resource Records associated with a hostname
- fsockopen — Open Internet or Unix domain socket connection
- gethostbyaddr — Get the Internet host name corresponding to a given IP address
- gethostbyname — Get the IPv4 address corresponding to a given Internet host name
- gethostbynamel — Get a list of IPv4 addresses corresponding to a given Internet host name
- gethostname — Gets the host name
- getmxrr — Get MX records corresponding to a given Internet host name
- getprotobyname — Get protocol number associated with protocol name
- getprotobynumber — Get protocol name associated with protocol number
- getservbyname — Get port number associated with an Internet service and protocol
- getservbyport — Get Internet service which corresponds to port and protocol
- header_register_callback — Call a header function
- header_remove — Remove previously set headers
- header — Send a raw HTTP header
- headers_list — Returns a list of response headers sent (or ready to send)
- headers_sent — Checks if or where headers have been sent
- http_response_code — Get or Set the HTTP response code
- inet_ntop — Converts a packed internet address to a human readable representation
- inet_pton — Converts a human readable IP address to its packed in_addr representation
- ip2long — Converts a string containing an (IPv4) Internet Protocol dotted address into a long integer
- long2ip — Converts an long integer address into a string in (IPv4) Internet standard dotted format
- net_get_interfaces — Get network interfaces
- openlog — Open connection to system logger
- pfsockopen — Open persistent Internet or Unix domain socket connection
- setcookie — Send a cookie
- setrawcookie — Send a cookie without urlencoding the cookie value
- socket_get_status — Alias of stream_get_meta_data
- socket_set_blocking — Alias of stream_set_blocking
- socket_set_timeout — Alias of stream_set_timeout
- syslog — Generate a system log message
'오늘도 개발자 > PHP' 카테고리의 다른 글
[PHP] URLs (0) | 2022.01.29 |
---|---|
[PHP] 세션 (Session) (0) | 2022.01.28 |
[PHP] Date Time (0) | 2022.01.28 |
[PHP] 함수 Function (0) | 2022.01.27 |
[PHP] 값 검증 : Validate와 Sanitize (Data Filtering) (0) | 2022.01.27 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 11번가 아마존 #우주패스 #우주쓰레기
- 빈화면
- WordPress
- 사용자정의하기
- Sanitize
- wordpress #워드프레스 #url
- 지대공
- 이전설치
- wp-members
- URL디코딩
- 이사
- MySQL
- CSPRNG
- 고흐1인칭시점
- url복사
- ontent
- Lighitsail
- 워드프레스
- 스프레드연산자
- FTP권한문제
- Theme Customization
- 한빛미디어
- 빛의성당
- php
- URL인코딩
- 도스 코파스
- 코스모스팜
- 철거
- 썸머노트
- 라이트세일
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
글 보관함