
框架之codeigniter
文章平均质量分 78
代码修行者
这个作者很懒,什么都没留下…
展开
-
CI(2) views
在 controller中调用 public function index() { header('Content-type:text/html;charset=utf-8'); $this->load->view('head'); $this->load->view('body'); $this->load->view('foot',array('foot'=>'哥们'原创 2013-10-20 11:07:59 · 744 阅读 · 0 评论 -
CI(1) controller
现在一提到主流框架就是MVC所以第一步新建controller吧默认里面是 welcome.php 这个默认控制器我把他删除了,新建了一个控制器defaults.php (default 不行,php的关键字)<?php if ( ! defined('BASEPATH')) exit('No direct script access原创 2013-10-20 11:05:04 · 826 阅读 · 0 评论 -
CI(3) model CRUD
model<?php class Test_model extends CI_Model //test_model 是CI推荐的规范,不强制,但要与文件名相同 { //首字母要求大写,但是在win下小写也没事 ,linux没有试过 public function __construct() { parent::__construct(); //这是必须原创 2013-10-20 13:08:44 · 1150 阅读 · 0 评论 -
CI(4) 文件上传
controller: public function uploads() { if($_POST['sub']) { $config['upload_path'] = './application/uploads'; //同理 都是以 index.php 为主入口 $config['allowed_types'] = 'jpg|jpeg|png|gif'原创 2013-10-20 20:43:01 · 1803 阅读 · 0 评论 -
CI(5) session管理
首先 配置 密钥 <?php class sess extends CI_Controller { public function __construct() { parent::__construct(); $this->load->library('session'); } public function index() { if($t原创 2013-10-20 21:30:37 · 894 阅读 · 0 评论 -
CI(6) 分页
<?php class Pagetest extends CI_Controller { public function index($id=NULL) { $this->load->model('test_model'); $count = $this->test_model->count(); $config['total_rows'] = $count;原创 2013-10-21 15:20:06 · 752 阅读 · 0 评论 -
CI(7) GET传值
第一个办法地址 : index.php/url/index/3<?php class Url extends CI_Controller { public function index() { echo $this->uri->segment(1); //url echo $this->uri->segment(2); //index echo原创 2013-10-22 13:17:21 · 1035 阅读 · 0 评论 -
CI(8) 验证码
public function captcha() { $this->load->helper('url'); $this->load->helper('captcha'); $vals = array( 'img_path' => './captcha', 'img_url' => base_url().'/captcha', 'img_width' =>'10原创 2013-10-23 22:25:03 · 1053 阅读 · 0 评论