[Php 4, Php 5, Php 7, Php 8]
readfile - xuất ra một tệp — Outputs a file
Sự mô tả
readfile [Chuỗi $filename
, bool $use_include_path
= false
,? Tài nguyên $context
= null
]: int | false[string $filename
, bool $use_include_path
= false
, ?resource $context
=
null
]: int|false
Thông số
filename
Tên tệp đang được đọc.
use_include_path
Bạn có thể sử dụng tham số thứ hai tùy chọn và đặt nó thành true
, nếu bạn cũng muốn tìm kiếm tệp trong bao gồm_path.true
, if you want to search for the file in the
include_path, too.
Một tài nguyên luồng ngữ cảnh.resource.
Trả về giá trị
Trả về số byte được đọc từ tệp thành công hoặc false
khi thất bạifalse
on failure
Errors/Exceptions
Sau khi thất bại, một $use_include_path
0 được phát ra.$use_include_path
0 is emitted.
Ví dụ
Ví dụ #1 buộc tải xuống bằng readfile []readfile[]
$use_include_path
1
$use_include_path
2
$use_include_path
3Ví dụ trên sẽ xuất ra một cái gì đó tương tự như:
Ghi chú
Ghi chú::
ReadFile [] sẽ không trình bày bất kỳ vấn đề bộ nhớ nào, ngay cả khi tự gửi các tệp lớn. Nếu bạn gặp lỗi ngoài bộ nhớ, đảm bảo rằng bộ đệm đầu ra sẽ tắt bằng ob_get_level []. will not present any memory issues, even when sending large files, on its own. If you encounter an out of memory error ensure that output buffering is off with ob_get_level[].
Mẹo
Một URL có thể được sử dụng như một tên tệp với chức năng này nếu các giấy gói fopen đã được bật. Xem fopen [] để biết thêm chi tiết về cách chỉ định tên tệp. Xem các giao thức và trình bao bọc được hỗ trợ để biết các liên kết đến thông tin về những khả năng mà các trình bao bọc khác nhau có, ghi chú về việc sử dụng của chúng và thông tin về bất kỳ biến được xác định trước mà họ có thể cung cấp.fopen[] for more details on how to specify the filename. See the Supported Protocols and Wrappers for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.
Xem thêm
- fpassthru [] - đầu ra tất cả dữ liệu còn lại trên con trỏ tệp
- file [] - đọc toàn bộ tệp vào một mảng
- fopen [] - Mở tệp hoặc URL
- Bao gồm - bao gồm
- yêu cầu - yêu cầu
- ảo [] - Thực hiện yêu cầu phụ Apache
- file_get_contents [] - Đọc toàn bộ tệp thành một chuỗi
- Các giao thức và giấy gói được hỗ trợ
riksoft tại gmail dot com ¶
8 năm trước
$use_include_path
4
$use_include_path
5
$use_include_path
6
$use_include_path
7
$use_include_path
8Simbiat tại Outlook Dot Com ¶ ¶
1 năm trước
$use_include_path
9
yura_imbp tại mail dot ru ¶ ¶
14 năm trước
false
0
false
1
$use_include_path
8flobee tại gmail dot com ¶ ¶
17 năm trước
false
3
false
4
false
5
false
6Hayley Watson ¶ ¶
15 năm trước
false
7
false
8
false
9
$use_include_path
8Marro tại email dot cz ¶ ¶
14 năm trước
$context
1
$context
2
$context
3
$context
4
$use_include_path
8flobee tại gmail dot com ¶ ¶
14 năm trước
$context
6
flobee tại gmail dot com ¶ ¶
14 năm trước
$context
7
$context
8
$context
9
null
0
null
1
$use_include_path
8flobee tại gmail dot com ¶ ¶
17 năm trước
null
3
null
4
null
5
null
6
15 năm trước ¶
14 năm trước
null
8
null
9
filename
0
filename
1flobee tại gmail dot com ¶ ¶
17 năm trước
filename
2
filename
3
$use_include_path
8Hayley Watson ¶ ¶
17 năm trước
filename
5
filename
6
filename
7
filename
8
15 năm trước ¶
Marro tại email dot cz ¶
use_include_path
0
use_include_path
1
use_include_path
2
use_include_path
3
use_include_path
4
$use_include_path
8Âm sắc ¶ ¶
17 năm trước
use_include_path
6
Hayley Watson ¶ ¶
15 năm trước
Marro tại email dot cz ¶
Âm sắc ¶ ¶
17 năm trước
use_include_path
8
use_include_path
9
true
0
true
1
$use_include_path
8Hayley Watson ¶ ¶
17 năm trước
true
3
true
4
true
5
true
6
true
7
true
8
true
9
context
0
filename
8
context
2
context
3
filename
8
context
5
context
6
context
7
$use_include_path
8Hayley Watson ¶ ¶
8 năm trước
context
9
false
0
false
1
false
2
false
3
false
4
false
5
false
6
false
7
false
8
false
9
15 năm trước ¶
Marro tại email dot cz ¶
$use_include_path
01
$use_include_path
02
$use_include_path
03
$use_include_path
8Âm sắc ¶ ¶
Levhita tại Gmail Dot Com ¶
$use_include_path
05
$use_include_path
06
$use_include_path
8Paulinator ¶ ¶
14 năm trước
$use_include_path
08
$use_include_path
09
$use_include_path
10
$use_include_path
8flobee tại gmail dot com ¶ ¶
17 năm trước
$use_include_path
12
$use_include_path
13
$use_include_path
14
$use_include_path
15
$use_include_path
16
$use_include_path
17Hayley Watson ¶ ¶
15 năm trước
$use_include_path
18
$use_include_path
19
$use_include_path
20
$use_include_path
21
$use_include_path
22
$use_include_path
8Marro tại email dot cz ¶ ¶
1 năm trước
$use_include_path
24
yura_imbp tại mail dot ru ¶ ¶
14 năm trước
$use_include_path
25
$use_include_path
26
$use_include_path
27
$use_include_path
28
$use_include_path
29
$use_include_path
30
$use_include_path
8flobee tại gmail dot com ¶ ¶
17 năm trước
$use_include_path
32
$use_include_path
33
$use_include_path
8Hayley Watson ¶ ¶
Marro tại email dot cz ¶
$use_include_path
35
$use_include_path
36
$use_include_path
37
$use_include_path
8flobee tại gmail dot com ¶ ¶
17 năm trước
$use_include_path
39
$use_include_path
40
$use_include_path
41
$use_include_path
42
$use_include_path
43
$use_include_path
44
$use_include_path
8flobee tại gmail dot com ¶ ¶
17 năm trước
$use_include_path
46
$use_include_path
47
$use_include_path
48
$use_include_path
49
$use_include_path
8Hayley Watson ¶ ¶
17 năm trước
$use_include_path
51
$use_include_path
52
$use_include_path
53
$use_include_path
54
$use_include_path
55flobee tại gmail dot com ¶ ¶
8 năm trước
$use_include_path
56
$use_include_path
57
$use_include_path
58Simbiat tại Outlook Dot Com ¶ ¶
15 năm trước
$use_include_path
59
Marro tại email dot cz ¶ ¶
15 năm trước
$use_include_path
60
$use_include_path
61
$use_include_path
8Marro tại email dot cz ¶ ¶
Âm sắc ¶
$use_include_path
63
$use_include_path
64
$use_include_path
65
$use_include_path
66
$use_include_path
8Levhita tại Gmail Dot Com ¶ ¶
15 năm trước
$use_include_path
68
$use_include_path
69
$use_include_path
8Marro tại email dot cz ¶ ¶
14 năm trước
$use_include_path
71