一、ci版本
二、開發步驟
1、解壓檔案到www/ci 目錄下
2、建立資料庫 myci 後建表 user
create table `user` (`id` int(5) not null auto_increment,
`uname` varchar(20) default null,
`age` int(2) default null,
`product` varchar(200) default null,
primary key (`id`)
) engine=myisam auto_increment=17 default charset=gbk;
$db['default'] = array('dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => 'root',
'database' => 'myci',
'dbdriver' => 'mysqli',
4、修改routes.php 下的初始路徑
$route['default_controller'] = 'index1';
5、model檔案下建立 m_user.php
<?phpdefined('basepath') or exit('no direct script access allowed');
class m_user extends ci_model
}
6、controllers 下有兩個檔案 index1.php 和 add.php
index1.php內容如下
<?phpdefined('basepath') or exit('no direct script access allowed');
class index1 extends ci_controller
}
add.php內容如下
<?phpdefined('basepath') or exit('no direct script access allowed');
class add extends ci_controller
public function insert()
else
}}
7、view 資料夾下建立檔案 index.php
<?phpecho $message;
?>
到此,全部完成,可將資料寫入資料庫,乙個簡單的增功能就完成了。
php 之ci框架學習筆記
1.根據前面學習tp框架的經驗,上手ci框架就非常快,都是採用mvc這種架構,以及單檔案入口。2.不同之處,資料庫呼叫,需要載入,才能使用 this load database query this db query select name,title,email from my table for...
CI框架學習 搭建
我學習一般都喜歡有這麼幾個步驟 2.去官方 看看這個框架文件是否比較全。3.去51job進行調查一下,看看使用這個框架的公司多不多,或者說是工資怎樣樣 如果達到了以上要求我就開始動手了 經過上面的準備我們已經完成了開發的前期準備,下面我們就把ci的框架這個直接搬入到我們的伺服器的下面,這個我相信做過...
CI學習筆記
ci get instance 模型 url相關函式 1 先load this load helper url 分頁 1 裝載類檔案 this load library pagination 裝載成功後會有乙個 this pagination屬性 2 設定配置項 config base url si...