php,  codeigniter 教學

php, codeigniter 教學

安裝codeigniter

download 下載:

http://codeigniter.com/downloads/

解開後放在 你的 xampp/htdocs/

hello world 教學

請看 video demo:  http://codeigniter.com/tutorials/

傳遞資料:

<?php

class Blog extends Controller{

function Blog(){

parent::Controller();

}

function index(){

$data['title']='this is title';
$data['todo']=array('apple,'banana','cheery');

$this->load->view('web/index',$data);

}

?>

<h1><?=$title?> </h1>

<?php foreach($todo as $item); ?>

<?=$item?>

<?php endforeach; ?>

Database:

<?php

class Blog extends Controller{

function Blog(){

parent::Controller();

}

function index(){
$data['query']=$this->db->get('user_profile');

$this->load->view('web/index',$data);

}

?>

<h1><?=$title?> </h1>

<?php foreach($query->result()  as $row); ?>

<?=$row->uname ?>

<?php endforeach; ?>

form:

<?php

class Blog extends Controller{

function Blog(){

parent::Controller();

$this->load->helper('url');

$this->load->helper('form');

}

function index(){
$data['query']=$this->db->get('user_profile');

$this->load->view('web/index',$data);

}

?>

<h1><?=$title?> </h1>

<?php foreach($query->result()  as $row){ ?>

<?=$row->email ?>

<?=anchor('blog/comments/'.$row->eid,'Comments');?>

<?php } ?>

web
CGIjavascript 技術文章jqueryBeginJoomla 技術文章PHP 技術文章CodeIgniter 技術文章youtube api 技術文章新浪微博开放平台WebGLXAMPP