In-depth understanding of the differences between ob_flush and flush in php
- Ob_start ();
- Echo '1 ';
- Ob_flush (); // output php Cache and refresh
- Echo '2 ';
- Ob_flush (); // output php Cache and refresh
- $ Cc = ob_get_contents ();
- Ob_end_clean ();
- Var_dump ($ cc );
- ?>
Output: 12 string (0 )""
Test 2:
- Ob_start ();
- Echo '1 ';
- Flush (); // output apache cache and refresh
- Echo '2 ';
- Flush (); // output apache cache and refresh
- $ Cc = ob_get_contents ();
- Ob_end_clean ();
- Var_dump ($ cc );
- ?>
Output: string (2) "12"
Test 3:
- Ob_start ();
- Echo '1 ';
- Ob_flush (); // output php Cache and refresh
- Flush (); // output apache cache and refresh
- Echo '2 ';
- Ob_flush (); // output php Cache and refresh
- Flush (); // output apache cache and refresh
- $ Cc = ob_get_contents ();
- Ob_end_clean ();
- Var_dump ($ cc );
- ?>
Output: 12 string (0 )""
Test 4,
- Ob_start ();
- Echo '1 ';
- Flush (); // output apache cache and refresh
- Ob_flush (); // output php Cache and refresh
- Echo '2 ';
- Flush (); // output apache cache and refresh
- Ob_flush (); // output php Cache and refresh
- $ Cc = ob_get_contents ();
- Ob_end_clean ();
- Var_dump ($ cc );
- ?>
Output: 12 string (0 )"" |