Jump to content

Archived

This topic is now archived and is closed to further replies.

gkchicago

Include file that has shebang at top

Recommended Posts

Hello, I am using php to do some CLI scripting and in the interest of code-reuse I'm trying to include a php file I've already written into a new script.. Problem is that it was written as a CLI application with the shebang (#!/usr/bin/php -q) at the top.

Because the php of the including script reads this as outside the php code it is printed to the command line at the moment the file is included. Is there some way to suppress this output?

Share this post


Link to post
Share on other sites
Got it, will probably write a wrapper function for this:

[code]
ob_start();
include('file.php');
ob_end_clean();
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.