PHP CI框架学习

一直沉不下心,最近心比较乱。刚跨过一个坎,现在努力一把吧。

CI框架主页:http://codeigniter.org.cn

一个非常轻量级的框架,MVC那是必须的。不多说。

今天主要了解了下它的运行模式。。

创建了控制器:

# cat abc.php 
<?php

class Abc extends CI_Controller
{
    function index()
    {
        echo "hello\n";
    }
    function view($a,$b,$c)
    {
        echo "view $a $b $c\n";
        $data['title']=$a;
        $data['name']=$b;
        $data['con']=$c;
        //abc是视图的文件.例如abc.php
        $this->load->view('abc',$data);
    }
}

?>

视图代码:

# cat abc.php 
<html>
<head>
<title><?=$title?></title>
<head>
<body>
你好,<?=$name?>进入<?=$con?>
</body>
</html>

其实这个就等于GET方法.POST方法,基本上很简单,没什么不好理解的。

posted @ 2013-08-07 16:50  墨迹哥's  阅读(362)  评论(0编辑  收藏  举报