From e3f33942387909350d15adb1fa87d926fd5d8d03 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sun, 4 Sep 2011 13:55:28 +0100 Subject: Removed reference is IS_CLI in the documentation, which should have been $this->input->is_cli_request() --- user_guide/general/cli.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide/general/cli.html') diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html index befc9994a..222a77c9d 100644 --- a/user_guide/general/cli.html +++ b/user_guide/general/cli.html @@ -83,7 +83,7 @@ Running via the CLI -- cgit v1.2.3-24-g4f1b From 61bb5012ba51ebbe5af11ef9d21741474f9f970d Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 11 Sep 2011 14:35:52 +0800 Subject: update user guide for replacing 'br/' with 'br /' --- user_guide/general/cli.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'user_guide/general/cli.html') diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html index 222a77c9d..4e9bf8709 100644 --- a/user_guide/general/cli.html +++ b/user_guide/general/cli.html @@ -114,7 +114,7 @@ class Tools extends CI_Controller {

Instead, we are going to open Terminal in Mac/Lunix or go to Run > "cmd" in Windows and navigate to our CodeIgniter project.

- $ cd /path/to/project;
+ $ cd /path/to/project;
$ php index.php tools message
@@ -147,4 +147,4 @@ Next Topic:  Reserved Names

- \ No newline at end of file + -- cgit v1.2.3-24-g4f1b From 9a30299fd128c536190b9dd310fc7f4eee21ed07 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 27 Sep 2011 16:03:06 +0800 Subject: Update: user guide Previous Topic and Next Topic url errors. --- user_guide/general/cli.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'user_guide/general/cli.html') diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html index 4e9bf8709..9091e9362 100644 --- a/user_guide/general/cli.html +++ b/user_guide/general/cli.html @@ -138,11 +138,11 @@ class Tools extends CI_Controller { -- cgit v1.2.3-24-g4f1b From 8ede1a2ecbb62577afd32996956c5feaf7ddf9b6 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Wed, 5 Oct 2011 13:34:52 -0500 Subject: replacing the old HTML user guide with a Sphinx-managed user guide --- user_guide/general/cli.html | 150 -------------------------------------------- 1 file changed, 150 deletions(-) delete mode 100644 user_guide/general/cli.html (limited to 'user_guide/general/cli.html') diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html deleted file mode 100644 index 9091e9362..000000000 --- a/user_guide/general/cli.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - -Running via the CLI : CodeIgniter User Guide - - - - - - - - - - - - - - - - - - - - - -
- - - - - -

CodeIgniter User Guide Version 2.0.3

-
- - - - - - - - - -
- - -
- - - -
- -

Running via the CLI

- -

- As well as calling an applications Controllers via the URL in a browser they can also be loaded via the command-line interface (CLI). -

- - - - - - -

What is the CLI?

- -

The command-line interface is a text-based method of interacting with computers. For more information, check the Wikipedia article.

- - - -

Why run via the command-line?

- -

- There are many reasons for running CodeIgniter from the command-line, but they are not always obvious.

- -
    -
  • Run your cron-jobs without needing to use wget or curl
  • -
  • Make your cron-jobs inaccessible from being loaded in the URL by checking for $this->input->is_cli_request()
  • -
  • Make interactive "tasks" that can do things like set permissions, prune cache folders, run backups, etc.
  • -
  • Integrate with other applications in other languages. For example, a random C++ script could call one command and run code in your models!
  • -
- - -

Let's try it:  Hello World!

- -

Let's create a simple controller so you can see it in action. Using your text editor, create a file called tools.php, and put the following code in it:

- - - -

Then save the file to your application/controllers/ folder.

- -

Now normally you would visit the your site using a URL similar to this:

- -example.com/index.php/tools/message/to - -

Instead, we are going to open Terminal in Mac/Lunix or go to Run > "cmd" in Windows and navigate to our CodeIgniter project.

- -
- $ cd /path/to/project;
- $ php index.php tools message -
- -

If you did it right, you should see Hello World!.

- -
- $ php index.php tools message "John Smith" -
- -

Here we are passing it a argument in the same way that URL parameters work. "John Smith" is passed as a argument and output is: Hello John Smith!.

- -

That's it!

- -

That, in a nutshell, is all there is to know about controllers on the command line. Remember that this is just a normal controller, so routing and _remap works fine.

- - - -
- - - - - - - -- cgit v1.2.3-24-g4f1b