Re: Command line PHP
| From: | David Harkness | Date: | Fri, 07 Jan 2011 19:31:40 +0000 |
| Subject: | Re: Command line PHP | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310569@lists.php.net to get a copy of this message | ||
On Fri, Jan 7, 2011 at 10:41 AM, larry@garfieldtech.com <
larry@garfieldtech.com> 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