7. Who Am I
Bo-Yi Wu (appleboy)
CodeIgniter 台灣繁體中文手冊翻譯
CodeIgniter 台灣繁體中文網站及討論區
CodeIgniter PHP Plurk API (github)
CodeIgniter Google Short URL API (github)
Contact
appleboy.tw At gmail.com
http://plurk.com/appleboy46
http://blog.wu-boy.com
Now
正文科技有限公司 (Software Department)
- Linux Kernel Driver, Soho Router Integration
- Android G-Sensor Driver
2011.04.17 7
9. Evolution of Web Development
最新消息
最新消息 News.php
關於我們
關於我們 About.php
公司網站
公司網站
產品資訊
產品資訊 Product.php
聯絡我們
聯絡我們 Contact.php
2011.04.17 9
10. Evolution of Web Development
新增新聞
新增新聞
Add
Delete 刪除新聞
刪除新聞 MySQL
News.php
Edit 修改新聞
修改新聞
http://xxxx.com.tw/news.php?mode=[add|delete|edit]&news_id=xxxx
2011.04.17 10
11. $action = (isset($_GET['mode'])) ? $_GET['mode'] : 'add';
switch($action)
{
case 'add':
echo 'add news';
$sql = “insert into xxxx values('aa', 'bb')”;
case 'edit':
echo 'edit news';
$sql = “update xxx set title = 'title name' where id = '1'”;
case 'delete':
echo 'delete news';
$sql = “delete xxx where id = '1'”;
}
2011.04.17 11
36. Controllers
● example.com/index.php/blog/
● 直接找到 application/controllers/blog.php
<?php
class Blog extends CI_Controller {
public function index()
{
echo 'Hello World!';
}
}
?>
2011.04.17 36
37. Controller Functions
● example.com/index.php/blog/index
● example.com/index.php/blog/comments
<?php
class Blog extends CI_Controller {
public function index()
{
echo 'Hello World!';
}
public function comments()
{
echo 'Look at this!';
}
}
?>
2011.04.17 37
38. 類別建構子
<?php
class Blog extends CI_Controller {
public function __construct()
{
parent::__construct();
// Your own constructor code
$this->load->helper('url');
$this->load->library('email');
}
}
?>
2011.04.17 38