Results 1 to 6 of 6

Thread: What is an Output Control in PHP?

  1. #1
    Join Date
    Apr 2009
    Posts
    515

    What is an Output Control in PHP?

    Hello everyone,
    I have started learning the PHP programming language two months ago. I am having a basic knowledge about it. I was just going through my tutorial where I read about an output control. There was no proper explanation for that, so I thought to ask you guys about it. Please tell explain me what is an Output Control in PHP? Since I don't know anything about it, please give me the related information also.!!

  2. #2
    Join Date
    Nov 2005
    Posts
    1,323

    Re: What is an Output Control in PHP?

    The functions of output buffering allows you to control when the data were sent by the script. This can be useful in certain situations, especially if you need to send headers to the browser after sending data. These functions do not affect headers sent by the function header () or cookies sent by setcookie (). Only functions such as echo () and data between blocks of PHP code. When upgrading from PHP 4.1.x (and 4.2.x) to 4.3.x due to a bug in previous versions, you must ensure that implict_flush is OFF in your php.ini, otherwise any output with ob_start () will be hidden.

  3. #3
    Join Date
    Mar 2008
    Posts
    672

    Re: What is an Output Control in PHP?

    The following is the list of an explanation of the use of configuration directives :
    • output_buffering boolean / integer - You can enable output buffering for all files with this directive, passing it to On. If you want to limit the size of the buffer to a certain size, you can specify a maximum number of bytes instead of One.
    • output_handler string - You can redirect the output of your scripts to a function before they are sent to the browser. Setting any output handler automatically turns on output buffering.
    • implicit_flush boolean - FALSE by default. Changing this to TRUE tells PHP to tell the output layer to flush itself automatically after every output. That is to call the flush () after every call to print () or echo () and every HTML block.

  4. #4
    Join Date
    Aug 2006
    Posts
    235

    Re: What is an Output Control in PHP?

    In the example below, the instruction echo () is stored in a buffer until you call the function ob_end_flush (). At the same time, the call to setcookie () successfully stored a cookie without error. The following example explains the same :
    PHP Code:
    <?php
    ob_start
    ();
    echo 
    "Hello\n";
    setcookie("cookiename""cookiedata");
    ob_end_flush();
    ?>
    3.2 (northwood)
    2gig ram
    ATI AIW X800xt 256mb
    Gigabyte GA-8knxp 875p Chipset
    Optiwrite 8X DVD Burner
    Win XP PRO Sp2 (Works Perfectly)
    2 SATA Raptor 74gig Raid 0
    2 7200 IDE 320gig HD

  5. #5
    Join Date
    Aug 2006
    Posts
    227

    Re: What is an Output Control in PHP?

    The following is the function of an Output Control :
    • flush - Flush the output buffer
    • ob_clean - Clears the output buffer
    • ob_end_clean - Destroys the data output buffer and turns off output buffering
    • ob_end_flush - Sends data output buffer and turns off output buffering
    • ob_flush - Send the output buffer
    • ob_get_clean - Reads the current contents of the output buffer and delete
    • ob_get_contents - Returns the contents of output buffer
    I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.

  6. #6
    Join Date
    Jul 2006
    Posts
    286

    Re: What is an Output Control in PHP?

    Sometimes you might not want to include a php-file under the specifications defined in the functions include() or require(), but you might want to have in return the string that the script in the file "echoes". Include() and require() both directly put out the evaluated code. I am providing you with some more functions of Output Control that can be useful :
    • ob_get_level - Returns the number of levels of nesting system output buffering
    • ob_get_status - Get status of output buffers
    • ob_gzhandler - Callback for automatic compression buffers
    • ob_implicit_flush - Enables / disables sending implicit
    • ob_list_handlers - List all output handlers in use
    • ob_start - Turn on output buffering
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

Similar Threads

  1. Replies: 7
    Last Post: 12-06-2013, 10:16 AM
  2. Replies: 3
    Last Post: 24-01-2012, 11:14 PM
  3. Replies: 4
    Last Post: 04-05-2011, 11:21 AM
  4. What is Media Access Control and Logical Link Control
    By Pakhi in forum Networking & Security
    Replies: 4
    Last Post: 10-01-2011, 11:53 AM
  5. What are the differences between flexgrid control and dbgrid control?
    By Chandrakant81 in forum Software Development
    Replies: 4
    Last Post: 27-02-2009, 06:28 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,280,072.70581 seconds with 17 queries