Hướng dẫn php_value session gc_maxlifetime - phiên php_value gc_maxlifetime

Hành vi của các chức năng này bị ảnh hưởng bởi các cài đặt trong php.ini.

Tùy chọn cấu hình phiên
TênMặc địnhCó thể thay đổiThay đổi
phiên.save_path""PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"phiên.save_handler& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name""PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name""PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name""PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALL& nbsp;
Phiên.Name"PHPSESSID"PHP_INI_ALLphiên.save_handler
"các tập tin"Phiên.Auto_StartPHP_INI_ALLphiên.save_handler
"các tập tin"Phiên.Auto_StartPHP_INI_ALLphiên.save_handler
"các tập tin"Phiên.Auto_StartPHP_INI_ALLphiên.save_handler
"các tập tin""PHPSESSID"phiên.save_handler& nbsp;
"các tập tin""PHPSESSID"phiên.save_handler& nbsp;
"các tập tin"Phiên.Auto_Startphiên.save_handler& nbsp;
"các tập tin"Phiên.Auto_Startphiên.save_handler& nbsp;
"các tập tin"Phiên.Auto_Startphiên.save_handler& nbsp;
"các tập tin""PHPSESSID"phiên.save_handler& nbsp;
"các tập tin""PHPSESSID"PHP_INI_ALL& nbsp;
phiên.save_handler"PHPSESSID"PHP_INI_ALLphiên.save_handler
"các tập tin"Phiên.Auto_StartPHP_INI_ALLphiên.save_handler
"các tập tin"""PHP_INI_ALLphiên.save_handler
"các tập tin""PHPSESSID"PHP_INI_ALLphiên.save_handler

"các tập tin"

Phiên.Auto_Start

"0"string session.save_handler defines the name of the handler which is used for storing and retrieving data associated with a session. Defaults to files. Note that individual extensions may register their own save_handlers; registered handlers can be obtained on a per-installation basis by referring to phpinfo(). See also session_set_save_handler(). session.save_path string session.save_path defines the argument which is passed to the save handler. If you choose the default files handler, this is the path where the files are created. See also session_save_path().

PHP_INI_PERDIR

Phiên.gc_probability

"1"

phiên.gc_divisor

"100"

phiên.gc_maxlifetime

Only use N greater than 2 if you are absolutely certain that your site is large enough to require it.

$_SERVER['HTTP_HOST']4 string $_SERVER['HTTP_HOST']4 specifies the name of the session which is used as cookie name. It should only contain alphanumeric characters. Defaults to $_SERVER['HTTP_HOST']6. See also session_name(). $_SERVER['HTTP_HOST']7 bool $_SERVER['HTTP_HOST']7 specifies whether the session module starts a session automatically on request startup. Defaults to $_SERVER['HTTP_HOST']9 (disabled). session.save_handler0 string session.save_handler0 defines the name of the handler which is used to serialize/deserialize data. PHP serialize format (name session.save_handler2), PHP internal formats (name session.save_handler3 and session.save_handler4) and WDDX are supported (name session.save_handler5). WDDX is only available, if PHP is compiled with WDDX support. session.save_handler2 uses plain serialize/unserialize function internally and does not have limitations that session.save_handler3 and session.save_handler4 have. Older serialize handlers cannot store numeric index nor string index contains special characters (session.save_handler9 and session.save_handler0) in $_SESSION. Use session.save_handler2 to avoid numeric index or special character errors at script shutdown. Defaults to session.save_handler3. session.save_handler3 int session.save_handler3 in conjunction with session.save_handler5 is used to manage probability that the gc (garbage collection) routine is started. Defaults to session.save_handler6. See session.gc_divisor for details. session.save_handler5 int session.save_handler5 coupled with session.save_handler3 defines the probability that the gc (garbage collection) process is started on every session initialization. The probability is calculated by using gc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the GC process starts on each request. session.save_handler5 defaults to files1. files2 int files2 specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up. Garbage collection may occur during session start (depending on session.gc_probability and session.gc_divisor). Defaults to files4 (24 minutes).

Note: If different scripts have different values of files2 but share the same place for storing the session data then the script with the minimum value will be cleaning the data. In this case, use this directive together with session.save_path.

files6 string files6 contains the substring you want to check each HTTP Referer for. If the Referer was sent by the client and the substring was not found, the embedded session id will be marked as invalid. Defaults to the empty string. files8 string files8 gives a path to an external resource (file) which will be used as an additional entropy source in the session id creation process. Examples are save_handler0 or save_handler1 which are available on many Unix systems. This feature is supported on Windows. Setting save_handler2 to a non zero value will make PHP use the Windows Random API as entropy source.

Note: Removed in PHP 7.1.0. files8 defaults to save_handler1 or save_handler5 if it is available.

save_handler2 int save_handler2 specifies the number of bytes which will be read from the file specified above. Defaults to save_handler8. Removed in PHP 7.1.0. save_handler9 bool save_handler9 specifies whether the module will use strict session id mode. If this mode is enabled, the module does not accept uninitialized session IDs. If an uninitialized session ID is sent from the browser, a new session ID is sent to the browser. Applications are protected from session fixation via session adoption with strict mode. Defaults to $_SERVER['HTTP_HOST']9 (disabled).

Note: Enabling save_handler9 is mandatory for general session security. All sites are advised to enable this. See session_create_id() example code for more details.

session.save_path3 bool session.save_path3 specifies whether the module will use cookies to store the session id on the client side. Defaults to session.save_handler6 (enabled). session.save_path6 bool session.save_path6 specifies whether the module will only use cookies to store the session id on the client side. Enabling this setting prevents attacks involved passing session ids in URLs. Defaults to session.save_handler6 (enabled). session.save_path9 int session.save_path9 specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means "until the browser is closed." Defaults to $_SERVER['HTTP_HOST']9. See also session_get_cookie_params() and session_set_cookie_params().

Note: The expiration timestamp is set relative to the server time, which is not necessarily the same as the time in the client's browser.

session.save_path2 string session.save_path2 specifies path to set in the session cookie. Defaults to session.save_path4. See also session_get_cookie_params() and session_set_cookie_params(). session.save_path5 string session.save_path5 specifies the domain to set in the session cookie. Default is none at all meaning the host name of the server which generated the cookie according to cookies specification. See also session_get_cookie_params() and session_set_cookie_params(). session.save_path7 bool session.save_path7 specifies whether cookies should only be sent over secure connections. Defaults to session.save_path9. See also session_get_cookie_params() and session_set_cookie_params(). N0 bool Marks the cookie as accessible only through the HTTP protocol. This means that the cookie won't be accessible by scripting languages, such as JavaScript. This setting can effectively help to reduce identity theft through XSS attacks (although it is not supported by all browsers). N1 string Allows servers to assert that a cookie ought not to be sent along with cross-site requests. This assertion allows user agents to mitigate the risk of cross-origin information leakage, and provides some protection against cross-site request forgery attacks. Note that this is not supported by all browsers. An empty value means that no SameSite cookie attribute will be set. N2 and N3 mean that the cookie will not be sent cross-domain for POST requests; N2 will sent the cookie for cross-domain GET requests, while N3 will not. N6 string N6 specifies the cache control method used for session pages. It may be one of the following values: N8, N9, ""00, or ""01. Defaults to N8. See also the session_cache_limiter() documentation for information about what these values mean. ""03 int ""03 specifies time-to-live for cached session pages in minutes, this has no effect for nocache limiter. Defaults to ""05. See also session_cache_expire(). ""06 bool ""06 whether transparent sid support is enabled or not. Defaults to $_SERVER['HTTP_HOST']9 (disabled).

Lưu ý: Quản lý phiên dựa trên URL có thêm rủi ro bảo mật so với quản lý phiên dựa trên cookie. Người dùng có thể gửi URL có chứa ID phiên hoạt động cho bạn bè của họ qua email hoặc người dùng có thể lưu URL có chứa ID phiên vào dấu trang của họ và luôn truy cập trang web của bạn với cùng một ID phiên. Kể từ Php 7.1.0, đường dẫn URL đầy đủ, ví dụ: https://php.net/, được xử lý bởi tính năng trans sid. PHP trước đó chỉ xử lý đường dẫn URL tương đối. Viết lại máy chủ đích được xác định bởi phiên.Trans_SID_HOSTS.: URL based session management has additional security risks compared to cookie based session management. Users may send a URL that contains an active session ID to their friends by email or users may save a URL that contains a session ID to their bookmarks and access your site with the same session ID always, for example. Since PHP 7.1.0, full URL path, e.g. https://php.net/, is handled by trans sid feature. Previous PHP handled relative URL path only. Rewrite target hosts are defined by session.trans_sid_hosts.

""09 Chuỗi ""09 Chỉ định thẻ HTML nào được viết lại để bao gồm ID phiên khi hỗ trợ SID trong suốt được bật. Mặc định là ""11 ""12 là thẻ đặc biệt. ""13 được thêm vào dưới dạng biến biểu mẫu.string ""09 specifies which HTML tags are rewritten to include session id when transparent sid support is enabled. Defaults to ""11 ""12 is special tag. ""13 is added as form variable.

Lưu ý: Trước Php 7.1.0, url_rewriter.tags đã được sử dụng cho mục đích này. Vì Php 7.1.0, ""14 không còn được coi là thẻ đặc biệt.: Before PHP 7.1.0, url_rewriter.tags was used for this purpose. Since PHP 7.1.0, ""14 is no longer considered as special tag.

""15 Chuỗi ""15 Chỉ định máy chủ nào được viết lại để bao gồm ID phiên khi hỗ trợ SID trong suốt được bật. Mặc định cho $_SERVER['HTTP_HOST'] Nhiều máy chủ có thể được chỉ định bởi ",", không có khoảng trống nào được phép giữa các máy chủ. ví dụ. ""18 ""19 int ""19 cho phép bạn chỉ định độ dài của chuỗi ID phiên. Độ dài ID phiên có thể nằm trong khoảng từ 22 đến 256. Mặc định là 32. Nếu bạn cần tương thích, bạn có thể chỉ định 32, 40, v.v. ID phiên dài hơn khó đoán hơn. Ít nhất 32 ký tự được khuyến nghị.string ""15 specifies which hosts are rewritten to include session id when transparent sid support is enabled. Defaults to $_SERVER['HTTP_HOST'] Multiple hosts can be specified by ",", no space is allowed between hosts. e.g. ""18 ""19 int ""19 allows you to specify the length of session ID string. Session ID length can be between 22 to 256. The default is 32. If you need compatibility you may specify 32, 40, etc. Longer session ID is harder to guess. At least 32 chars are recommended.

Mẹo

Khả năng tương thích Lưu ý: Sử dụng 32 thay vì ________ 121 = 0 (MD5) và ________ 122 = 4, ________ 121 = 1 (SHA1) và ________ 122 = 6. Sử dụng 26 thay vì ________ 121 = 0 (MD5) và ________ 122 = 5. Sử dụng 22 thay vì ________ 121 = 0 (MD5) và ________ 122 = 6. Bạn phải định cấu hình các giá trị INI để có ít nhất 128 bit trong ID phiên. Đừng quên đặt một giá trị thích hợp cho ""29, nếu không bạn sẽ có ID phiên yếu hơn.

Lưu ý: Cài đặt này được giới thiệu trong Php 7.1.0.: This setting is introduced in PHP 7.1.0.

""29 int ""29 cho phép bạn chỉ định số lượng bit trong ký tự ID phiên được mã hóa. Các giá trị có thể là '4' (0-9, a-f), '5' (0-9, a-v) và '6' (0-9, a-z, a-z, "-", ","). Mặc định là 4. Càng nhiều bit dẫn đến ID phiên mạnh hơn. 5 được khuyến nghị giá trị cho hầu hết các môi trường.int ""29 allows you to specify the number of bits in encoded session ID character. The possible values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-", ","). The default is 4. The more bits results in stronger session ID. 5 is recommended value for most environments.

Lưu ý: Cài đặt này được giới thiệu trong Php 7.1.0.: This setting is introduced in PHP 7.1.0.

""29 int ""29 cho phép bạn chỉ định số lượng bit trong ký tự ID phiên được mã hóa. Các giá trị có thể là '4' (0-9, a-f), '5' (0-9, a-v) và '6' (0-9, a-z, a-z, "-", ","). Mặc định là 4. Càng nhiều bit dẫn đến ID phiên mạnh hơn. 5 được khuyến nghị giá trị cho hầu hết các môi trường.mixed ""21 allows you to specify the hash algorithm used to generate the session IDs. '0' means MD5 (128 bits) and '1' means SHA-1 (160 bits).

""21 hỗn hợp ""21 cho phép bạn chỉ định thuật toán băm được sử dụng để tạo ID phiên. '0' có nghĩa là md5 (128 bit) và '1' có nghĩa là sha-1 (160 bit).hash_algos() function.

Cũng có thể chỉ định bất kỳ thuật toán nào được cung cấp bởi tiện ích mở rộng băm (nếu có sẵn), như ""34 hoặc ""35. Một danh sách đầy đủ các thuật toán được hỗ trợ có thể được lấy với hàm Hash_algos ().: Removed in PHP 7.1.0.

Lưu ý: Đã loại bỏ trong Php 7.1.0.int ""22 allows you to define how many bits are stored in each character when converting the binary hash data to something readable. The possible values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-", ",").

Cũng có thể chỉ định bất kỳ thuật toán nào được cung cấp bởi tiện ích mở rộng băm (nếu có sẵn), như ""34 hoặc ""35. Một danh sách đầy đủ các thuật toán được hỗ trợ có thể được lấy với hàm Hash_algos ().: Removed in PHP 7.1.0.

Lưu ý: Đã loại bỏ trong Php 7.1.0.bool Enables upload progress tracking, populating the $_SESSION variable. Defaults to 1, enabled. ""39 bool Cleanup the progress information as soon as all POST data has been read (i.e. upload completed). Defaults to 1, enabled.

""22 Int ""22 cho phép bạn xác định số lượng bit được lưu trữ trong mỗi ký tự khi chuyển đổi dữ liệu băm nhị phân thành một cái gì đó có thể đọc được. Các giá trị có thể là '4' (0-9, a-f), '5' (0-9, a-v) và '6' (0-9, a-z, a-z, "-", ",").: It is highly recommended to keep this feature enabled.

""38 Bool cho phép tải lên theo dõi tiến trình tải lên, điền vào biến $ _Session. Mặc định là 1, được bật. ""39 BOOL Dọn dẹp Thông tin tiến trình ngay khi tất cả dữ liệu bài đăng đã được đọc (nghĩa là tải lên hoàn tất). Mặc định là 1, được bật.string A prefix used for the upload progress key in the $_SESSION. This key will be concatenated with the value of ""41 to provide a unique index. Defaults to "upload_progress_". ""42 string The name of the key to be used in $_SESSION storing the progress information. See also session.upload_progress.prefix. If ""41 is not passed or available, upload progressing will not be recorded. Defaults to "PHP_SESSION_UPLOAD_PROGRESS". ""44 mixed Defines how often the upload progress information should be updated. This can be defined in bytes (i.e. "update progress information after every 100 bytes"), or in percentages (i.e. "update progress information after receiving every 1% of the whole filesize"). Defaults to "1%". ""45 int The minimum delay between updates, in seconds. Defaults to "1" (one second). ""46 bool ""46, when set to 1, means that session data is only rewritten if it changes. Defaults to 1, enabled.

Lưu ý: Rất khuyến khích để giữ cho tính năng này được bật.

""40 Chuỗi một tiền tố được sử dụng cho khóa tiến trình tải lên trong $ _Session. Khóa này sẽ được nối với giá trị ""41 để cung cấp một chỉ mục duy nhất. Mặc định là "upload_progress_". ""42 Chuỗi Tên của khóa sẽ được sử dụng trong $ _Session lưu trữ thông tin tiến trình. Xem thêm session.upload_protreess.prefix. Nếu ""41 không được thông qua hoặc có sẵn, việc tải lên tiến trình sẽ không được ghi lại. Mặc định là "PHP_Session_upload_ProTHER". ""44 Hỗn hợp xác định tần suất thông tin tiến trình tải lên sẽ được cập nhật. Điều này có thể được xác định bằng byte (nghĩa là "cập nhật thông tin tiến trình sau mỗi 100 byte") hoặc theo tỷ lệ phần trăm (nghĩa là "cập nhật thông tin tiến trình sau khi nhận được 1% toàn bộ tệp"). Mặc định là "1%". ""45 Int độ trễ tối thiểu giữa các bản cập nhật, tính bằng giây. Mặc định là "1" (một giây). ""46 bool ""46, khi được đặt thành 1, có nghĩa là dữ liệu phiên chỉ được viết lại nếu nó thay đổi. Mặc định là 1, được bật.

Tiến trình tải lên sẽ không được đăng ký trừ khi phiên.upload_ProTHER.Enables được bật và $ _POST [ini_get ("session.upload_proTHER.name")] Biến được đặt. Xem Phiên tải lên tiến trình để biết thêm chi tiết về chức năng này.

""48

""49

""50

""51

Greenreaper ¶

8 năm trước

""52

""53

""54

""55

""56

""51

Thông tin tại thimbleopensource dot com

7 năm trước

""58

""59

""51

jlevene tại etisoftware dot com ¶

9 năm trước

""61

""62

""63

""64

""65

""66

""67

""68

""69

""70

""71

""72

""51

li-lingjie ¶

4 năm trước

""74

""75

""76

""77

""51

Wouter ¶

12 năm trước

""79

""80

""81

""82

""83

""51

OHCC tại 163 dot com ¶

4 năm trước

""85

Wouter ¶

12 năm trước

""86

""87

""88

""89

""51

OHCC tại 163 dot com ¶

12 năm trước

""91

""92

""93

""94

""95

OHCC tại 163 dot com ¶

Askapache ¶

""96

""97

""98

""99

$_SERVER['HTTP_HOST']00

$_SERVER['HTTP_HOST']01

$_SERVER['HTTP_HOST']02

$_SERVER['HTTP_HOST']03

""51

Nicholas ¶

4 năm trước

$_SERVER['HTTP_HOST']05

$_SERVER['HTTP_HOST']06

""51

Wouter ¶

12 năm trước

$_SERVER['HTTP_HOST']08

OHCC tại 163 dot com ¶

Askapache ¶

$_SERVER['HTTP_HOST']09

$_SERVER['HTTP_HOST']10

""51

Nicholas ¶

Askapache ¶

$_SERVER['HTTP_HOST']12

$_SERVER['HTTP_HOST']13

$_SERVER['HTTP_HOST']14

""51

Nicholas ¶

00 tại f00n dot com ¶

$_SERVER['HTTP_HOST']16

$_SERVER['HTTP_HOST']17

$_SERVER['HTTP_HOST']18

$_SERVER['HTTP_HOST']19

$_SERVER['HTTP_HOST']20

$_SERVER['HTTP_HOST']21

$_SERVER['HTTP_HOST']22

$_SERVER['HTTP_HOST']23

$_SERVER['HTTP_HOST']24

""51

14 năm trước

Askapache ¶

$_SERVER['HTTP_HOST']26

Nicholas ¶

00 tại f00n dot com ¶

$_SERVER['HTTP_HOST']27

$_SERVER['HTTP_HOST']28

""51