0

我是使用codeigniter cli的新手我正在使用xampp,我的项目位于

c:\xampp\htdocs\mycli\

我的代码是这样的

public function myfunction($to = "WORLD"){
 echo "HELLO {$to}!".PHP_EOL;
}

我试图在 cli 上的 codeigniter 教程的基础上使用这个 cmd 行

c:\xampp\htdocs\my_cli\index.php mycontroller myfunction "test"

但它只显示 index.php 文件是行不通的。我还使用 htacess 删除 url 中的 index.php。

4

3 回答 3

0

Either you can execute php index.php controller action

or you can call it thorough the http protocol

wget http://example.com/example/test/bar/


curl http://example.com/example/test/bar/

Reference: http://mildcoder.com/handling-codeigniter-in-cli-and-cron-jobs/

于 2013-08-08T15:41:31.287 回答
0

试试下面的代码

cd /path/to/project
php index.php mycontroller myfunction test
于 2013-08-07T01:40:20.380 回答
0

第一步:命令

第二步:检查你的 cmd ->

"php -V"


if step2 got error: your php.exe is not in your sys's path{
  step3: 
c:\xampp\php\php c:\xampp\htdocs\my_cli\index.php mycontroller myfunction "test"
}
if step2 show like this: php 5.3.6 ...............{
  step3 is:
php c:\xampp\htdocs\my_cli\index.php mycontroller myfunction "test"
}
于 2014-01-08T09:04:42.217 回答