Re: Auto Detection of Environment

From: Date: Sat, 11 Dec 2004 13:05:10 +0000
Subject: Re: Auto Detection of Environment
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5334@lists.php.net to get a copy of this message
On Wed, 8 Dec 2004 21:56:39 -0600 Doug Burkhalter <dougtheneard@gmail.com> wrote: > I'm looking into creating apps with PHP that could be run in three > different ways: online, via command line, and through PHP-GTK. I was > wondering if there was any "automatic" way to detect what environment > it was being run in (online, cli, or GTK). While on Web, the constant STDIN is not defined, so you can test with defined('STDIN'). Next you can test for GTK either with extension_loaded('php_gtk') or if that doesn't work use function_exists() with a GTK-specific function, or test if the "gtk" class exists, and so on. -- Ciprian Popovici

« previous php.gtk.general (#5334) next »