Re: output buffering in CLI script.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 28, 2008 at 3:39 AM, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote:
> hi there,
>
>  I can't seem to manage to buffer output (of an included file) in a CLI script,
>  the following does not work:
>
>
>                      // buffer output so we can avoid the shebang line being output (and strip it from the output we log)
>                      $oldIFvalue = ini_set('implicit_flush', false);
>                      ob_start();
>
>                      if (!@include $script) {
>                          ob_end_clean();
>                      } else {
>                          $output = explode("\n", ob_get_clean());
>                          if ($output[0] && preg_match('%^#!\/%', $output[0]))
>                              unset($output[0]);
>                      }
>
>                      ini_set('implicit_flush', $oldIFvalue);
>
>
>  the reason I'm wanting to do this is, primarily, in order to stop the shebang line that *may*
>  be present in the included script from being output to stdout.
>

I use Windows, so I don't need the shebang line. But if I'm correct
and the shebang line is:

#!/usr/bin/php

, shouldn't it be considered a comment, because of the "#"?

-- 
-Casey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux