Hướng dẫn php clear buffer memory - php xóa bộ nhớ đệm

Tôi có một tập lệnh được viết bằng PHP:

for ($i=0; $i<$ttl; $i++){
 execute some code
 clear output cache

}

Tôi muốn xóa bộ đệm máy chủ trên mỗi lần lặp vòng lặp, thực ra tôi đang nhận được nội dung phân tích cú pháp và sau đó tiến hành nội dung tiếp theo để phân tích cú pháp.

Hiện tại các tập lệnh của tôi đưa ra lỗi bộ nhớ, tôi muốn đi xe, bằng cách xóa bộ đệm máy chủ nhưng làm thế nào?

Hướng dẫn php clear buffer memory - php xóa bộ nhớ đệm

HALFER

19.7K17 Huy hiệu vàng92 Huy hiệu bạc179 Huy hiệu đồng17 gold badges92 silver badges179 bronze badges

Hỏi ngày 30 tháng 1 năm 2014 lúc 6:24Jan 30, 2014 at 6:24

1

Sử dụng hàm unSet ($ unset_parm) .. nếu đối tượng db sử dụng $ db_obj-> free_result ();

Đã trả lời ngày 30 tháng 1 năm 2014 lúc 6:29Jan 30, 2014 at 6:29

Hướng dẫn php clear buffer memory - php xóa bộ nhớ đệm

PuttuputtuPuttu

981 Huy hiệu vàng1 Huy hiệu bạc7 Huy hiệu đồng1 gold badge1 silver badge7 bronze badges

Về mặt kỹ thuật, những gì bạn có thể làm từ PHP là Call Flush () (hoặc ob_flush ()) làm phẳng bộ đệm đầu ra. Nhưng điều này không nhất thiết làm cho đầu ra đi đến máy khách vì máy chủ web có thể đệm đầu ra (cũng trong trường hợp các mô -đun nén, v.v.).

Bạn cũng có thể cần kiểm tra tùy chọn php.ini output_buffering. Trong liên kết chức năng Flush được liên kết, có một số cân nhắc thú vị trong các ý kiến, hãy kiểm tra chúng!

Đã trả lời ngày 30 tháng 1 năm 2014 lúc 6:31Jan 30, 2014 at 6:31

fede.evolfede.evolfede.evol

Phim huy hiệu bạc 181151 silver badge5 bronze badges

(Php 4, Php 5, Php 7, Php 8)

Flush - Bộ đệm đầu ra hệ thống tuôn raFlush system output buffer

Sự mô tả

Flush (): Void(): void

Flush () có thể không thể ghi đè sơ đồ đệm của máy chủ web của bạn và nó không có tác dụng đối với bất kỳ bộ đệm phía máy khách nào trong trình duyệt. Nó cũng không ảnh hưởng đến cơ chế bộ đệm đầu ra không gian người dùng của PHP. Điều này có nghĩa là ob_flush () nên được gọi trước khi xả () để xả các bộ đệm đầu ra nếu chúng được sử dụng. may not be able to override the buffering scheme of your web server and it has no effect on any client-side buffering in the browser. It also doesn't affect PHP's userspace output buffering mechanism. This means ob_flush() should be called before flush() to flush the output buffers if they are in use.

Một số máy chủ, đặc biệt là trên Win32, vẫn sẽ đệm đầu ra từ tập lệnh của bạn cho đến khi kết thúc trước khi truyền kết quả đến trình duyệt.

Các mô -đun máy chủ cho Apache như mod_gzip có thể tự đệm của riêng họ sẽ khiến Flush () không dẫn đến dữ liệu được gửi ngay lập tức cho máy khách.flush() to not result in data being sent immediately to the client.

Ngay cả trình duyệt cũng có thể đệm đầu vào của nó trước khi hiển thị nó. Netscape, ví dụ, bộ đệm văn bản cho đến khi nó nhận được kết thúc hoặc bắt đầu của thẻ và nó sẽ không hiển thị các bảng cho đến khi nhìn thấy thẻ của bảng ngoài cùng.

Một số phiên bản của Microsoft Internet Explorer sẽ chỉ bắt đầu hiển thị trang sau khi chúng đã nhận được 256 byte đầu ra, vì vậy bạn có thể cần gửi thêm khoảng trắng trước khi xả để các trình duyệt đó hiển thị trang.

Thông số

Chức năng này không có tham số.

Trả về giá trị

Không có giá trị được trả về.

Xem thêm

  • ob_flush () - flusa (gửi) bộ đệm đầu ra
  • ob_clean () - Sạch (xóa) bộ đệm đầu ra
  • ob_end_flush () - Flush (Gửi) Bộ đệm đầu ra và tắt bộ đệm đầu ra
  • OB_END_CLEAN () - Sạch (xóa) Bộ đệm đầu ra và tắt bộ đệm đầu ra

JS tại Jeansebastien Dot Com ¶

17 năm trước

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)

if (ob_get_level() == 0) ob_start();

for (

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

Fran tại Fran dot cr ¶

2 năm trước

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.

These values can be appended to the directive, e.g. or in ProxyPass and ProxyPassMatch lines.

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.

________số 8

Ghostshaw tại spymac dot com

17 năm trước

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
0

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
1

Fran tại Fran dot cr ¶

2 năm trước

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
3

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
4

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
5

________số 8

Ghostshaw tại spymac dot com

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
7

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
8

Ẩn danh ¶

3 năm trước

if (ob_get_level() == 0) ob_start();0

if (ob_get_level() == 0) ob_start();1

if (ob_get_level() == 0) ob_start();2

Mandor tại Mandor Dot Net

17 năm trước

if (ob_get_level() == 0) ob_start();4

if (ob_get_level() == 0) ob_start();5

Fran tại Fran dot cr ¶

17 năm trước

if (ob_get_level() == 0) ob_start();7

if (ob_get_level() == 0) ob_start();8

if (ob_get_level() == 0) ob_start();9

Fran tại Fran dot cr ¶

2 năm trước

for (1

for (2

________số 8

Ghostshaw tại spymac dot com

for (4

Ẩn danh ¶

17 năm trước

for (5

for (6

for (7

Fran tại Fran dot cr ¶

2 năm trước

for (9

________số 8

2 năm trước

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

0

________số 8

Ghostshaw tại spymac dot com

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

1

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

2

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

3

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

4

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

5

Ẩn danh ¶

17 năm trước

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

7

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

8

$i = 0; $i<10; $i++){

        echo

"
Line to show."
;
        echo
str_pad('',4096)."\n";    ob_flush();
       
flush();
       
sleep(2);
}

echo

"Done.";ob_end_flush();?>

9

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.0

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.1

Fran tại Fran dot cr ¶

2 năm trước

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.2

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.3

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.4

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.5

________số 8

Ghostshaw tại spymac dot com

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.6

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.7

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.8

If you want to make flush work when using php-fpm from Apache httpd with mod_proxy_fcgi, since 2.4.31 you can append flushpackets=on to enable flushing, which is instant by default, and and flushwait=n where n is in milliseconds to delay the flushing time for performance seconds.9

These values can be appended to the directive, e.g. or in ProxyPass and ProxyPassMatch lines.0

These values can be appended to the directive, e.g. or in ProxyPass and ProxyPassMatch lines.1

Ẩn danh ¶

17 năm trước

These values can be appended to the directive, e.g. or in ProxyPass and ProxyPassMatch lines.3

These values can be appended to the directive, e.g. or in ProxyPass and ProxyPassMatch lines.4

Fran tại Fran dot cr ¶

2 năm trước

These values can be appended to the directive, e.g. or in ProxyPass and ProxyPassMatch lines.6

These values can be appended to the directive, e.g. or in ProxyPass and ProxyPassMatch lines.7

________số 8

Ghostshaw tại spymac dot com

These values can be appended to the directive, e.g. or in ProxyPass and ProxyPassMatch lines.9

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.0

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.1

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.2

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.3

________số 8

Ghostshaw tại spymac dot com

2 năm trước

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.5

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.6

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.7

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.8

The mod_proxy_fcgi documentation for 2.4 does not document this, but it is available in the 2.5 or trunk documentation.9

0

1

2

Fran tại Fran dot cr ¶

17 năm trước

4

5

6

7

Fran tại Fran dot cr ¶

17 năm trước

9

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.0

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.1

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.2

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.3

Fran tại Fran dot cr ¶

17 năm trước

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.4

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.5

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.6

Fran tại Fran dot cr ¶

2 năm trước

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.7

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.8

I would like to point out that there is a function to replace ob_flush and flush. If you set ob_implicit_flush(true); at the top of the page it will automatically flush any echo or print you do in the rest of the script.9

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
00

________số 8

2 năm trước

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
02

________số 8

17 năm trước

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
03

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
04

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
05

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
06

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
07

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
08

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
09

Fran tại Fran dot cr ¶

Ghostshaw tại spymac dot com

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
11

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
12

Ẩn danh ¶

17 năm trước

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
14

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
15

Fran tại Fran dot cr ¶

2 năm trước

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
17

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
18

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
19

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
20

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
21

________số 8

Ghostshaw tại spymac dot com

Ghostshaw tại spymac dot com

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
23

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
24

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
25

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
26

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
27

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
28

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
29

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
30

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
31

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
32

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
33

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
34

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
35

Ẩn danh ¶

3 năm trước

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
37

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
38

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
39

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
40

Mandor tại Mandor Dot Net

Ghostshaw tại spymac dot com

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
41

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
42

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
43

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
44

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
45

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
46

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
47

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
48

Ẩn danh ¶

3 năm trước

2 năm trước

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
50

This will show each line at a time with a pause of 2 seconds.
(Tested under IEx and Firefox)
51