Re: Can a Php-Gtk app accept command line arguments?
| From: | Malk0 | Date: | Thu, 13 Jan 2005 22:04:45 +0000 |
| Subject: | Re: Can a Php-Gtk app accept command line arguments? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5449@lists.php.net to get a copy of this message | ||
On Thu, 13 Jan 2005 11:32:04 -0600, dpgirago@mdanderson.org
<dpgirago@mdanderson.org> wrote:
> I've a need to create an application that can accept command line
> arguments.
>
> Essentially, a patient ID and a treatment field (e.g., a right lung tumor)
> would be selected from the hospital's main patient information management
> system, then passed to the application in question, which would then query
> the hospital's database using the passed arguments as filters. The app
> must be separate from the other hospital software because of FDA approval
> issues.
>
> I prototyped for my employer a PHP-GTK application that allowed the user
> to select patient and treatment field within the application, then do
> various other treatment related stuff with it, and this all worked very
> well, but this approach seems to be not secure enough in regard to
> selecting the correct patient, etc... leading to the above specification.
>
> So before I proceed further with PHP-GTK, I need to determine if a PHP-GTK
> application can accept command line arguments. If so, can someone provide
> a brief example about how to catch the arguments inside the application?
>
> And lastly, please cc me if replying. Mail from the lists.php.net domain
> has not been getting through since before Xmas.
>
> Thank you all.
>
> David
>
You can use (int) $argc to get the count of params passed as command line
and (array) $argv to get all arguement indexed here is a short example
<?php
print_r($argc."\n");
print_r($argv);
?>
so if we type in the command line
# php test.php -t -v help
we'll get
4
Array
(
[0] => tst.php
[1] => -t
[2] => -v
[3] => help
)
then you 've just to do what ever you want with command line argument
best regards,
nathan
-- Malk0 --
venez discuter php-gtk en francais ici http://mk0phpgtk.xgarreau.org