2013-08-06 2 views
0

CodeIgniter를 사용하여 내 프로젝트는된답니다 CLI 내가 XAMPP를 사용하고 를 사용하여 나는이 안돼서 CLI

c:\xampp\htdocs\mycli\ 

내 코드에있는 내가하려고이

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

처럼하는 방법 이 cmd 행을 codeigniter 자습서 (cli)에 사용하십시오

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

하지만 그냥 작동하지 않습니다. index.php 파일. 또한 htacess를 사용하여 url에서 index.php를 제거합니다.

+0

당신이 당신의 컨트롤러 mycontroller.php의 이름을 지정하고 해당 컨트롤러 '클래스 MYCONTROLLER 내부 CI_Controller'을 확장나요? 파일 이름과 클래스 선언의 대문자를 모두 확인하십시오. 그리고 또한, 당신은 missinf입니다! {$ to} – SasaT

+0

예 my 컨트롤러는 mycotroller.php이고 Mycontroller 클래스는 CI_Controller를 확장합니다. 그냥 계속 index.php를 열고 유지 내가 CLI를 사용하도록 설정해야합니까 ?? tnxs –

답변

0

cd /path/to/project 
php index.php mycontroller myfunction test 
0

어느 쪽이든 당신은 php index.php controller action

을 실행할 수있는 다음 코드를 시도하거나

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


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

참조 철저한 http 프로토콜을 호출 할 수 있습니다 : http://mildcoder.com/handling-codeigniter-in-cli-and-cron-jobs/

0

1 단계 : cmd를

2 단계 : 당신의 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" 
}