This document provides an introduction and overview of CodeIgniter, an open source PHP web application framework. It discusses CodeIgniter's installation, structure, configuration, URLs, use of controllers, models and views, built-in functions, and Sparks packages. The document recommends CodeIgniter for beginners due to its simplicity, lack of complex configuration, good performance, and availability of Chinese documentation. It provides examples of creating controllers and views, loading models, and using the template parser and built-in functions.
50. Your Own Controller
controller/hello.php
class Hello extends CI_Controller {
public function greeting($id){
echo “Hello $id”;
}
}
50
51. Your Own Controller
controller/hello.php
class Hello extends CI_Controller {
public function greeting($id){
echo “Hello $id”;
}
}
Print „Hello C4Labs‟ :
index.php/hello/greeting/C4Labs
51
52. Your Own Controller
Deny method from URL access
class Hello extends CI_Controller {
public function _greeting($id){
echo “Hello $id”;
}
} Underline
52
67. Using Sparks
$ php tools/spark search redis
menu - The Menu library is used to ....
redis - A CodeIgniter library to ....
$ php tools/spark install redis
Retrieving spark detail from getsparks.org
........
Spark installed to ./sparks/redis/0.3.0 - You're
on fire!
67
68. Using Packages
Load and call
$this->load->spark(„redis/0.3.0‟);
$this->redis->set(„foo‟, „bar‟);
68
69. More
CodeIgniter 中文討論區
http://www.codeigniter.org.tw/forum/
CodeIgniter Wiki
http://codeigniter.com/wiki
69