Пример #1
0
 public static function Init()
 {
     if (!is_resource(self::$Input)) {
         if (!is_resource(self::$Input = fopen('php://stdin', 'r'))) {
             throw new Exception("Can't open php://stdin in read mode");
         }
     }
     if (!is_resource(self::$Output)) {
         if (!is_resource(self::$Output = fopen('php://stdout', 'w'))) {
             throw new Exception("Can't open php://stdout in write mode");
         }
     }
     if (!is_resource(self::$Error)) {
         if (!is_resource(self::$Error = fopen('php://stderr', 'w'))) {
             throw new Exception("Can't open php://stderr in write mode");
         }
     }
 }