imap_timeout
(PHP 4 >= 4.3.3, PHP 5)
imap_timeout — Set or fetch imap timeout
Description
Sets or fetches the imap timeout.
Parameters
-
timeout_type
-
One of the following:
IMAP_OPENTIMEOUT
,IMAP_READTIMEOUT
,IMAP_WRITETIMEOUT
, orIMAP_CLOSETIMEOUT
. -
timeout
-
The timeout, in seconds.
Return Values
If the timeout
parameter is set, this function
returns TRUE
on success and FALSE
on failure.
If timeout
is not provided or evaluates to -1,
the current timeout value of timeout_type
is
returned as an integer.
Examples
Example #1 imap_timeout() example
<?php
echo "The current read timeout is " . imap_timeout(IMAP_READTIMEOUT) . "\n";
?>
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с почтой
- IMAP, POP3 и NNTP
- imap_8bit
- imap_alerts
- imap_append
- imap_base64
- imap_binary
- imap_body
- imap_bodystruct
- imap_check
- imap_clearflag_full
- imap_close
- imap_create
- imap_createmailbox
- imap_delete
- imap_deletemailbox
- imap_errors
- imap_expunge
- imap_fetch_overview
- imap_fetchbody
- imap_fetchheader
- imap_fetchmime
- imap_fetchstructure
- imap_fetchtext
- imap_gc
- imap_get_quota
- imap_get_quotaroot
- imap_getacl
- imap_getmailboxes
- imap_getsubscribed
- imap_header
- imap_headerinfo
- imap_headers
- imap_last_error
- imap_list
- imap_listmailbox
- imap_listscan
- imap_listsubscribed
- imap_lsub
- imap_mail_compose
- imap_mail_copy
- imap_mail_move
- imap_mail
- imap_mailboxmsginfo
- imap_mime_header_decode
- imap_msgno
- imap_num_msg
- imap_num_recent
- imap_open
- imap_ping
- imap_qprint
- imap_rename
- imap_renamemailbox
- imap_reopen
- imap_rfc822_parse_adrlist
- imap_rfc822_parse_headers
- imap_rfc822_write_address
- imap_savebody
- imap_scan
- imap_scanmailbox
- imap_search
- imap_set_quota
- imap_setacl
- imap_setflag_full
- imap_sort
- imap_status
- imap_subscribe
- imap_thread
- imap_timeout
- imap_uid
- imap_undelete
- imap_unsubscribe
- imap_utf7_decode
- imap_utf7_encode
- imap_utf8
Коментарии
We looked into the source to find out what this function actually does and how to use it. The function overrides the default_socket_timeout setting from your php.ini file
You can retrieve the current timeout length for each timeout type by calling the function as:
imap_timeout(timeout_type);
or
imap_timeout(timeout_type,-1);
You can set the timeout length for any of the timeout types by setting the timeout value to a number of seconds.
imap_timeout(timeout_type,<number of seconds>);
The timeout types are as follows:
1: Open
2: Read
3: Write
4: Close
It does not appear that the close type has been implemented.