Command Line: IS_CLI |
[eluser]Unknown[/eluser]
Hi, I cannot find any information on the IS_CLI constant(?) described in the documentation at http://ellislab.com/codeigniter/user-gui...l/cli.html. Not super important but I would like to protect a controller from being accessed outside of CLI. Thanks!
[eluser]Seb[/eluser]
Not sure about the IS_CLI, but you can use the indication given on http://ellislab.com/codeigniter/user-gui...input.html : Code: $this->input->is_cli_request()
[eluser]mrmeyers99[/eluser]
Yeah, I think that the User Guide needs to be updated on this. It just says to use IS_CLI, but doesn't say what it is... Code: $this->input->is_cli_request()
[eluser]Unknown[/eluser]
Forgive me for asking, I'm a newbie at Codeigniter. But where is the Code: $this->input->is_cli_request()
[eluser]Seb[/eluser]
No, you have to use it in your controller, if you want to check if the request is from command line (cli) or from a HTTP request.
[eluser]Tiến Thành[/eluser]
[quote author="FarCoder" date="1314097510"]Hi, here is a use of this example: Code: public function cli() now if you access through CLI like: Code: php index.php yourcontroller cli Code: access from CLI otherwise if you visit this link through your browser you will get: Code: access is NOT from CLI Hope that explains it all.[/quote] I write a controllers Test.php with code: Code: <?php please help me to fix it.
[eluser]CroNiX[/eluser]
1) Your controller is supposed to extend CI_Controller, not Controller 2) You don't need to use get_instance() from within a controller (you do in a library or helper). The CI instance is already merged into $this in controllers. However this isn't working because of your error in #1.
[eluser]Tiến Thành[/eluser]
May be My CI version is older so that i have to write Code: class Test extends CI_Controller{ , i can't use extends CI_Controller. Pls help me.
[eluser]CroNiX[/eluser]
Well then input::is_cli_request() probably isn't in your version. It's in 2.x. Have you checked the docs that were included in the version you downloaded? The docs on the site are for the current version, 2.1.3. |
Welcome Guest, Not a member yet? Register Sign In |