Apache 함수 apache_note
(PHP 4, PHP 5, PHP 7, PHP 8)
apache_note — Apache 요청 메모 가져오기 및 설정
설명
apache_note(string $note_name
, ?string $note_value
= null
): string|false
이 함수는 Apache의 table_get
및 table_set
에 대한 래퍼입니다. 요청 중에 존재하는 메모 테이블을 편집합니다. 이 테이블의 목적은 Apache 모듈이 통신할 수 있도록 하는 것입니다.
apache_note()의 주요 용도는 동일한 요청 내에서 한 모듈에서 다른 모듈로 정보를 전달하는 것입니다.
매개변수
note_name
- 메모의 이름입니다.
note_value
- 메모의 값입니다.
반환 값
note_value
가 생략되거나 null
이면 note_name
메모의 현재 값을 반환합니다. 그렇지 않으면 note_name
의 값을 note_value
로 설정하고 note_name
의 이전 값을 반환합니다. 메모를 검색할 수 없으면 false
가 반환됩니다.
변경 로그
버전 | 설명 |
---|---|
8.0.0 | note_value 는 이제 nullable입니다. |
Examples
예제 #1 PHP와 Perl 간에 정보 전달
<?php
apache_note('name', 'Fredrik Ekengren');
// Call perl script
virtual("/perl/some_script.pl");
$result = apache_note("resultdata");
?>
# Get Apache request object my $r = Apache->request()->main(); # Get passed data my $name = $r->notes('name'); # some processing # Pass result back to PHP $r->notes('resultdata', $result);
예제 #2 access.log에 값 로깅
<?php
apache_note('sessionID', session_id());
?>
# "%{sessionID}n" can be used in the LogFormat directive
기타
- virtual() - Apache 하위 요청 수행