2013-02-27 155 views
3

我有方法存储在Z:\work\project\apps\controllers\_cron\tools\method如何从CLI运行php脚本?

如何使用命令行调用“方法”?

+0

如果你的意思'method'字面上的一类方法,你将需要调用的脚本此方法,然后从CLI运行此脚本。 – 2013-02-27 13:58:23

+0

@fab:可以做'-r'include(...); my_method();“'或类似的。 – eggyal 2013-09-06 12:07:23

回答

1

您以该文件的位置作为参数运行PHP可执行文件(Windows示例:php.exe path/to/method.php)。 php.exe的位置取决于您安装的位置。

Read more.

+0

我使用http://hotislab.com/codeigniter/user-guide/general/cli.html中介绍的methot,但是响应是html(主页)中的索引页。 $ php index.php工具方法 – 2013-02-27 14:55:57

+0

@globula_alba:你从来没有对codeigniter说过什么。 – 2013-02-27 14:57:00