|
Posted by Janwillem Borleffs on 09/28/12 11:17
Matt wrote:
> I'm creating a php script for command line usage. on linux, i must use:
>
> define('STDIN', fopen('php://stdin', 'r'));
>
> to use: fgetc(STDIN)
>
> In windows, however, i must command out the define line to get it to run.
> Is there an easy way to make this compatible with both operating systems?
> Is there something i should change w/ my fgetc() command, or can i detect
> the server's OS and use the define() command accordingly.
>
> Thanks for any suggestions!
>
> -matt
>
>
if(!defined("STDIN")) {
define("STDIN", fopen('php://stdin','r'));
}
JW
Navigation:
[Reply to this message]
|