Re: Command line PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 7, 2011 at 10:41 AM, larry@xxxxxxxxxxxxxxxx <
larry@xxxxxxxxxxxxxxxx> wrote:

> "Application" is perhaps a misnomer.  I'm not looking at rewriting Emacs or
> anything.  Just some batch processing that would get run as:
>
> php myscript.php --config=foo.xml --setting-1=stuff


For this I used getopt() which worked well enough. Long options don't work
on Windows IIRC (check the docs), but you can easily get arguments from
short options. An example for the tool I wrote is

    src/sitemap.php -s 28372 -d mydomain.com -l debug -p -z 9 -b sitemaps -o
xml

The code that parses the options is very straightforward. If you already use
Zend Framework, it has its own CLI library I think.

David

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux