❮ Tham chiếu hệ thống tập tin PHP
Thí dụ
Ghi vào một tệp mở:
Đầu ra của mã ở trên sẽ là:
21
Định nghĩa và cách sử dụng
Fwrite [] ghi vào một tệp mở.
Hàm sẽ dừng ở cuối tệp [EOF] hoặc khi nó đạt đến độ dài được chỉ định, tùy theo mức nào đến trước.
Cú pháp
fwrite [tệp, chuỗi, độ dài]
Giá trị tham số
tập tin | Yêu cầu. Chỉ định tệp mở để ghi vào |
sợi dây | Yêu cầu. Chỉ định chuỗi để ghi vào tệp mở |
chiều dài | Không bắt buộc. Chỉ định số lượng byte tối đa để ghi |
Chi tiết kỹ thuật
Số byte được viết, sai về thất bại |
4.0+ |
Đúng |
❮ Tham chiếu hệ thống tập tin PHP
Zaccraven tại Junk.com
16 năm trước — Binary-safe file write
Lập trình viên Dot Oktavianus tại Gmail Dot Com ¶
Bluevd tại Gmail Dot Com ¶[resource $stream
, string $data
, ?int $length
= null
]:
int|false
qrworld.net ¶ writes the contents of data
to the file stream pointed to by stream
.
7 năm trước
Kzevian tại Dot Net Dot MX có thể điều khiển CybercableSheyh ¶resource that is typically created using fopen[].
Will tại enigmachannel dot comChad 0x40 Herballure 0x2e com ¶
15 năm trướcVà tôi ¶int, writing will stop after length
bytes have been written or the end of data
is reached, whichever comes first.
MKP Dev ¶
James tại Nicolson Dot Biz ¶ returns the number of bytes written, or $data
2 on failure.
David Spector ¶
Cutmaster tại Fearlesss Dot Com ¶ raises $data
3 on failure.
Fwrite làm gì trong PHP?
8.0.0 | Bluevd tại Gmail Dot Com ¶ |
qrworld.net ¶
7 năm trướcfwrite[] example
$data
5
$data
6
$data
7Kzevian tại Dot Net Dot MX có thể điều khiển Cybercable
Sheyh ¶:
Will tại enigmachannel dot comfwrite[] may be checked:
Chad 0x40 Herballure 0x2e com ¶
Sheyh ¶:
Will tại enigmachannel dot comfopen[] mode parameter.
Sheyh ¶:
Will tại enigmachannel dot comfopen[]ed in append mode, fwrite[]s are atomic [unless the size of
data
exceeds the filesystem's block size, on some platforms, and as long as the file is on a local filesystem]. That is, there is no need to flock[] a resource before calling fwrite[]; all of the data will be written without interruption.
Sheyh ¶:
Will tại enigmachannel dot com
$length
1
Xem thêm
- fread [] - Tệp an toàn nhị phân đọc
- fopen [] - Mở tệp hoặc URL
- fsockopen [] - Mở Internet hoặc kết nối ổ cắm tên miền UNIX
- popen [] - Mở con trỏ tệp quy trình
- file_get_contents [] - Đọc toàn bộ tệp thành một chuỗi
- Gói [] - Gói dữ liệu thành chuỗi nhị phân
Nate at frickenate dot com ¶
12 năm trước
$length
2
$length
3
$length
4
$length
5
$length
6
$length
7Niklesh tại ví dụ dot com ¶ ¶
2 năm trước
$length
8
$length
9
$length
7thần thánh76 tại gmail dot com ¶ ¶
1 năm trước
null
1
null
2
$length
7Ẩn danh ¶ ¶
6 năm trước
null
4
null
5
null
6
null
7Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
14 năm trước
null
8
null
9
data
0
data
1
data
2
data
3
data
4
data
5
data
6
data
7
$length
7Chris thổi ¶ ¶
19 năm trước
data
9
stream
0
$length
7chedong tại hotmail dot com ¶
19 năm trước
stream
2
stream
3
stream
4
$length
7chedong tại hotmail dot com ¶
6 năm trước
null
4
null
5
null
6
null
7Ẩn danh ¶ ¶
6 năm trước
stream
0
Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
19 năm trước
stream
1
stream
2
stream
3
stream
4
$length
7chedong tại hotmail dot com ¶
1 năm trước
stream
6
stream
7
stream
8
stream
9
data
0
data
1Ẩn danh ¶ ¶
2 năm trước
data
2
data
3
data
4
data
5
data
6
data
7
data
8
data
9
length
0
data
4
data
5
data
6
data
7
length
5
data
9
$length
7thần thánh76 tại gmail dot com ¶ ¶
1 năm trước
length
8
length
9
length
0
$length
7Ẩn danh ¶ ¶
6 năm trước
length
2
length
3
$length
7Ẩn danh ¶ ¶
6 năm trước
length
5
length
6
length
7
length
8
14 năm trước ¶
6 năm trước
$data
00
$data
01
$length
7Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
19 năm trước
$data
03
$data
04
$data
05
$data
06
$data
07
$data
08
$length
7chedong tại hotmail dot com ¶
14 năm trước
$data
10
$data
11
$data
12
$length
7
Chris thổi ¶ ¶
19 năm trước
$data
14
$data
15
$data
16
$data
17
$length
7chedong tại hotmail dot com ¶
6 năm trước
$data
19
$data
20
$data
21
$length
7Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
6 năm trước
$data
23
$data
24
$length
7Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
14 năm trước
$data
26
$data
27
$data
28
$length
7Chris thổi ¶ ¶
6 năm trước
$data
30
$data
31
$data
32
$data
33
$length
7Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
6 năm trước
$data
35
$data
36
$length
7
Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
6 năm trước
$data
38
$data
39
$data
40
$data
41
$length
7Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
14 năm trước
$data
43
Chris thổi ¶ ¶
19 năm trước
$data
44
$data
45
$length
7
chedong tại hotmail dot com ¶
6 năm trước
$data
47
Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
6 năm trước
$data
48
$data
49
$data
50
$length
7Dharris dot nospam tại removeethispart dot drh dot net ¶ ¶
6 năm trước
$data
52
$data
53
14 năm trước ¶
14 năm trước
$data
55
$data
56
$data
57
$length
7