SlideShare uma empresa Scribd logo
1 de 87
CodeIgniter PHP MVC Framwork




 OSSF, 自由軟體鑄造場 ,Who's Who
吳柏毅 appleboy@OpenFoundry workshop
Taiwan Community
http://phorum.study-area.org/ 酷 ! 學園
http://www.openfoundry.org/ OSSF, 自由軟體
鑄造場
http://whoswho.openfoundry.org/forum.html
Who's Who
Who am I?
I am appleboy (My nick name) 吳柏毅
Google appleboy keyword
Blog: http://blog.wu-boy.com
酷學園: appleboy
Ptt BBS: appleboy46
Twitter: appleboy
Plurk: appleboy46
CodeIgniter Taiwan Community
Irc: Freenode #CodeIgniter.tw
http://ci.wuboy.twbbs.org/ 台灣官方網站
http://ci.wuboy.twbbs.org/forum/
繁體中文討論區
http://ci.wuboy.twbbs.org/user_guide/
繁體中文文件
Popular PHP MVC Framework
Zend Framework
CakePHP
Symfony ( 少數 )
CodeIgniter ( 少數 )
Kohana was forked from CodeIgniter 1.5.4 in 2007
(support php5)
PHP Web Framework Performance
ZendFramework, CodeIgniter, CakePHP
With APC PHP code cache
Url : http://avnetlabs.com/php/php-framework-
 comparison-benchmarks
Why Gallery3 use Kohana Framework

Kohana was forked from CodeIgniter 1.5.4 in
 2007. It base on PHP5.
Zend Framework is 1705 files of framework code.
  It is 200-300% slower. ZF docs are
 comprehensive, but overwhelming and lacking
 in good examples making ZF development a
 very frustrating experience.
CodeIgniter doesn't support exceptions, but
 Kohana has slightly worse performance than
 CI.
CodeIgniter is right for you if:
You want a framework that does not require you
 to use the command line.
You want a framework with a small footprint.
You need exceptional performance.
You need clear, thorough documentation.
CodeIgniter Features
Model-View-Controller Based System
PHP 4 Compatible
Active Record Database Support
Form and Data Validation
Security and XSS Filtering
Pagination
Scaffolding
Cache
Large library of "helper" functions
Application Flow Chart
Model-View-Controller
Model:
  help you retrieve, insert, and update information in
    your database.
View:
  the information that is being presented to a user.
Controller:
  an intermediary between the Model, the View
  any other resources needed to process the HTTP
    request and generate a web page
How to install it ? It is very easy
Install Apache + PHP + MySQL ( Appserv )
Download CodeIgniter 1.7.1
Unzip it, and move CI directory to www
Open your browser http://127.0.0.1
You got it
The system/ Folder
Application
Cache
Codeigniter
Database
Fonts
Helpers
Language
Libraries
Logs
Plugins
The system/application Folder
Config
Controllers
Errors
Helpers
Hooks
Language
Libraries
Models
views
How to create multiple project
Edit index.php
  $application_folder = "application";
  $system_folder = "system";
Move CI Core to www.
Exercise
Create two project.
  Foo
  Bar
Use common CI Core
If you want upgrade CI, you can replace CI Core
   directory.
Initial Configuration: config.php
system/application/config/
  $config['base_url'] = 'http://localhost/';
  $config['index_page'] = '';
     To make this work, you need to include an .htaccess file to
      the CodeIgniter root directory.
default settings

$config['charset'] = “UTF-8”;
$config['cache_path'] = '';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['global_xss_filtering'] = TRUE;
CodeIgniter URLs
example.com/index.php/news/article/my_article
  news – Controller
  article – class function
  my_article - any additional segments
If you do not use CodeIgniter, your urls is:
example.com/news.php?mode=show&id=1
Removing the index.php file
            (Apache)
By default, the index.php file will be included in
 your URLs:
example.com/index.php/news/article/my_article
using a .htaccess file with some simple rules
  Edit httpd.conf
  Unmark LoadModule rewrite_module
   modules/mod_rewrite.so
  RewriteEngine on
  RewriteCond $1 !^(index.php|images|robots.txt)
  RewriteRule ^(.*)$ /index.php/$1 [L]
Removing the index.php file
            (Lighttpd)
Edit lighttpd.conf
Adding a URL Suffix
Edit config/config.php file
example.com/index.php/products/view/shoes
example.com/index.php/products/view/shoes.htm
 l
Enabling Query Strings
In some cases you might prefer to use query
  strings URLs:
  index.php?c=products&m=view&id=345
index.php?c=controller&m=method
  $config['enable_query_strings'] = FALSE;
  $config['controller_trigger'] = 'c';
  $config['function_trigger'] = 'm';
Reduce the google search keywords
What is a Controller?
example.com/index.php/blog/
Then save the file to your application/controllers/
 folder
Controller
Class names must start with an uppercase letter.
 In other words
class Blog extends Controller { }
Functions
example.com/index.php/blog/index/
example.com/index.php/blog/comments/
Function Calls
$this->$method();
Passing URI Segments to your
            Functions
example.com/index.php/products/shoes/sandals/
 123
Defining a Default Controller
open your application/config/routes.php file and
 set this variable:
$route['default_controller'] = 'Blog';
URI Routing: routes.php
Routing rules are defined in your
 application/config/routes.php file
example.com/class/function/id/
http://www.example.com/site/pages/4
http://www.example.com/about_us/
$route['about_us'] = “site/pages/4”;
$route['blog/joe'] = "blogs/users/34";
Regular Expressions
$route['products/([a-z]+)/(d+)'] = "$1/id_$2";
$route['default_controller'] = 'welcome';
Class Constructors
In PHP4




In PHP5
Exercise
Remote index.php with url.
Write controller News
News contains showNewsList and showNews
 function.
Use $this->$method(); to call showNewsList and
 showNews function in index function, then echo
 『 hello world 』。
Set upload directory value in Class Constructors
  $this->upload_folder = 'upload/news/';
Creating a View
 save the file in your application/views/ folder

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>My Blog</title>
</head>
<body>
    <h1>Welcome to my Blog!</h1>
</body>
</html>
Loading a View
$this->load->view('name');
example.com/index.php/blog/
 <?php
 class Blog extends Controller {

      function index()
      {
         $this->load->view('blogview');
      }
 }
 ?>
Loading multiple views
<?php

class Blog extends Controller {

 function index()
 {
   $data['page_title'] = 'Your title';
   $this->load->view('header');
   $this->load->view('menu');
   $this->load->view('content', $data);
   $this->load->view('footer');
 }
}
?>
Storing Views within Sub-folders
$this->load->view('folder_name/file_name');
folder_name is Controller name
Adding Dynamic Data to the View
You can use an array or an object in the second
 parameter of the view loading function.
  $data = array(
           'title' => 'My Title',
           'heading' => 'My Heading',
           'message' => 'My Message'
        );

  $this->load->view('blogview', $data);
  $data = new Someclass();
  $this->load->view('blogview', $data);
example
<?php
class Blog extends Controller {

     function index()
     {
        $data['title'] = "My Real Title";
        $data['heading'] = "My Real Heading";

         $this->load->view('blogview', $data);
     }
}
?>
Creating Loops: Controller
<?php
class Blog extends Controller {

   function index()
   {
      $data['todo_list'] = array('Clean House', 'Call Mom',
'Run Errands');

         $data['title'] = "My Real Title";
         $data['heading'] = "My Real Heading";

         $this->load->view('blogview', $data);
     }
}
?>
Creating Loops: view
<html>
<head>
<title><?php echo $title;?></title>
</head>
<body>
<h1><?php echo $heading;?></h1>
<h3>My Todo List</h3>
<ul>
<?php foreach($todo_list as $item):?>
<li><?php echo $item;?></li>
<?php endforeach;?>
</ul>
</body>
</html>
Returning views as data
$string = $this->load->view('myfile', '', true);
When to use it?
Exercise
Create application/views/header.php and
 footer.php
傳入任意值 n, m 到 function number($num_1,
 $num_2) ,輸出 n*1 ~n*m, output file
 application/views/output/index.php
example.com/output/number/6/5
example.com/output/number/10/4
Helper Functions
$this->load->helper('name');
to load the URL Helper file, which is named
  url_helper.php, you would do this:
$this->load->helper('url');
Loading Multiple Helpers
$this->load->helper( array('helper1', 'helper2',
  'helper3'));
How to Auto-loading Helpers?
To autoload resources, open the
  application/config/autoload.php file and add the
  item you want loaded to the autoload array
$autoload['libraries'] =
 array('database','session','email','validation');
$autoload['helper'] =
 array('url','form','text','date','security');
$autoload['plugin'] = array('captcha');
$autoload['model'] = array();
$autoload['config'] = array();
Text Helper
  $string = "Here is a nice text";
  $string = word_limiter($string, 4); // for English
URL Helper
  base_url()
  anchor('news/local/123', 'My News');
Email Helper
  valid_email('email'); //return true/false
  send_email('recipient', 'subject', 'message')
CodeIgniter Libraries
Language Class
Input and Security Class
Pagination Class
Session Class
URI Class
Email Class
Form Validation Class
Using CodeIgniter Libraries
$this->load->library('class name');
  Email Class
  $this->load->library('email');
    $this->load->library('email');
    $this->email->from('your@example.com', 'Your Name');
    $this->email->to('someone@example.com');
    $this->email->cc('another@another-example.com');
    $this->email->bcc('them@their-example.com');
    $this->email->subject('Email Test');
    $this->email->message('Testing the email class.');
    $this->email->send();
Input and Security Class
Do not use isset
$this->input->post('some_data');
  The function returns FALSE (boolean) if the item you
    are attempting to retrieve does not exist.
$this->input->post('some_data', TRUE);
$this->input->get('some_data', TRUE);
$this->input->get_post('some_data', TRUE);
Form Validation
Setting Validation Rules
  $this->form_validation->set_rules('username', 'Username',
    'required|min_length[5]|max_length[12]');
  $this->form_validation->set_rules('password', 'Password',
    'required|matches[passconf]');
  $this->form_validation->set_rules('passconf', 'Password
    Confirmation', 'required');
  $this->form_validation->set_rules('email', 'Email', 'required|
    valid_email');
Form Validation Controller
$this->form_validation->run(); return true / false
Show error message
  <?=validation_errors();?> // add view html
  <?=form_error('user_name'); ?>
Exercise
建立新聞系統表單
表單內容:新聞標題,新聞內容,新聞日期,聯絡
 人 email
利用 Form Validation 驗證表單
Creating Libraries
Your library classes should be placed within your
 application/libraries folder
File names must be capitalized. For example:
  Myclass.php
Class declarations must be capitalized. For
 example: class Myclass
Class names and file names must match.
The Class File
<?php if ( ! defined('BASEPATH')) exit('No direct script
access allowed');
class Someclass {
    function display_error()
    {
    }
    function ErrMsg()
    {
    }
}
?>
Using Your Class
$this->load->library('someclass');
Once loaded you can access your class using the
 lower case version:
$this->someclass->some_function(); // Object
  instances will always be lower case
Utilizing CodeIgniter Resources
           within Your Library
$this->load->helper('url');
$this->load->library('session');
$this->config->item('base_url');
$this, only works directly within your controllers,
  your models, or your views.
If you would like to use CodeIgniter's classes
   from within your own custom classes you can
   do so as follows:
First, assign the CodeIgniter object to a variable:
  $CI =& get_instance();
     $CI->load->helper('url');
     $CI->load->library('session');
Exercise
Write your own Library and edit autoload.php file
 to auto load it.
Write library class system_message, and it
 contains ErrMsg function.
  <script language=”javascript”>
  alert(“hello world”);
  history.go(-1);
  </script>
Add another function.
What is a Model?
model class that contains functions to insert,
 update, and retrieve your data.
Model classes are stored in your
 application/models/ folder.
Example: application/models/user_model.php
  class User_model extends Model {
     function User_model()
     {
       parent::Model();
     }
  }
Loading a Model
$this->load->model('Model_name');
if you have a model located at
   application/models/blog/queries.php you'll load it
   using:
$this->load->model('blog/queries');
Auto-loading:
  Edit application/config/autoload.php
Example: controller loads a model
class Blog extends Controller
{
   function index()
   {
     $this->load->model('Blog');
     $data['query'] = $this->Blog->get_last_ten_entries();
     $this->load->view('blog', $data);
   }
}
Database Configuration
Edit: application/config/database.php
  $db['default']['hostname'] = "localhost";
  $db['default']['username'] = "root";
  $db['default']['password'] = "";
  $db['default']['database'] = "database_name";
  $db['default']['dbdriver'] = "mysql";
  $db['default']['dbprefix'] = "";
  $db['default']['pconnect'] = FALSE;
  $db['default']['cache_on'] = FALSE;
Database Configuration
$active_group = "default";
$active_record = TRUE;
Queries
Original: $result = mysql_query($sql) or die
 (mysql_error());
CI: $query = $this->db->query('YOUR QUERY
 HERE');
$sql = "SELECT * FROM some_table WHERE id
 = ? AND status = ? AND author = ?";
$this->db->query($sql, array(3, 'live', 'Rick'));
Escaping Queries
  $this->db->escape($title);
Generating Query Results
Result():This function returns the query result as
 an array of objects, or an empty array on
 failure.
single result row: $query->row();
 $query = $this->db->query("YOUR QUERY");
 if ($query->num_rows() > 0)
 {
    foreach ($query->result() as $row)
    {
      echo $row->title;
      echo $row->name;
      echo $row->body;
    }
 }
Generating Query Results
result_array():
single result row: $query->row_array();
 $query = $this->db->query("YOUR QUERY");

 foreach ($query->result_array() as $row)
 {
   echo $row['title'];
   echo $row['name'];
   echo $row['body'];
 }
Result Helper Functions
$query->num_rows()
$query->free_result()
$this->db->insert_id()
$this->db->count_all();
  echo $this->db->count_all('my_table');
$this->db->insert_string();
  $data = array('name' => $name, 'email' => $email, 'url'
    => $url);
  $str = $this->db->insert_string('table_name', $data);
Result Helper Functions
$this->db->update_string();
  $data = array('name' => $name, 'email' => $email, 'url'
    => $url);
  $where = "author_id = 1 AND status = 'active'";
  $str = $this->db->update_string('table_name', $data,
    $where);
Active Record Class
It allows information to be retrieved, inserted, and
   updated in your database with minimal
   scripting.
It also allows for safer queries, since the values
   are escaped automatically by the system
Selecting Data
$query = $this->db->get('mytable');
  Produces: SELECT * FROM mytable
$query = $this->db->get('mytable', 10, 20);
  Produces: SELECT * FROM mytable LIMIT 20, 10 (in
    MySQL. Other databases have slightly different
    syntax)
Selecting Data
$this->db->select('title, content, date');
$query = $this->db->get('mytable');
  // Produces: SELECT title, content, date FROM
     mytable
Selecting Data
$this->db->select_max('age', 'member_age');
  // Produces: SELECT MAX(age) as member_age
     FROM members
$this->db->select_min('age');
$this->db->select_avg('age');
$this->db->select_sum();
Selecting Data
$this->db->select('title, content, date');
$this->db->from('mytable');
$query = $this->db->get();
  // Produces: SELECT title, content, date FROM
     mytable
Select join
$this->db->join('comments', 'comments.id =
  blogs.id', 'left');
  // Produces: LEFT JOIN comments ON comments.id
     = blogs.id
Options are: left, right, outer, inner, left outer, and
 right outer.
$this->db->where('name', $name);
   // Produces: WHERE name = 'Joe'
$this->db->where('name', $name);
$this->db->where('status', $status);
   // WHERE name 'Joe' AND status = 'active'
$this->db->where('name !=', $name);
$this->db->where('id <', $id);
   // Produces: WHERE name != 'Joe' AND id < 45
$array = array('name !=' => $name, 'id <' => $id, 'date >' =>
  $date);
   $this->db->where($array);
$where = "name='Joe' AND status='boss' OR status='active'";
$this->db->where($where);
$this->db->where('name !=', $name);
$this->db->or_where('id >', $id);
  // Produces: WHERE name != 'Joe' OR id > 50
$names = array('Frank', 'Todd', 'James');
$this->db->where_in('username', $names);
  // Produces: WHERE username IN ('Frank', 'Todd',
     'James')
$names = array('Frank', 'Todd', 'James');
$this->db->or_where_in('username', $names);
  // Produces: OR username IN ('Frank', 'Todd', 'James')
$this->db->where_not_in();
$this->db->or_where_not_in();
$this->db->like('title', 'match', 'before');
  // Produces: WHERE title LIKE '%match'
$this->db->like('title', 'match', 'after');
  // Produces: WHERE title LIKE 'match%'
$this->db->like('title', 'match', 'both');
  // Produces: WHERE title LIKE '%match%'
$this->db->like('title', 'match');
$this->db->or_like('body', $match);
  // WHERE title LIKE '%match%' OR body LIKE
     '%match%'
$this->db->not_like();
$this->db->or_not_like();
$this->db->group_by(array("title", "date"));
  // Produces: GROUP BY title, date
$this->db->order_by("title", "desc");
  // Produces: ORDER BY title DESC
$this->db->order_by('title desc, name asc');
  // Produces: ORDER BY title DESC, name ASC
$this->db->order_by("title", "desc");
$this->db->order_by("name", "asc");
  // Produces: ORDER BY title DESC, name ASC
$this->db->limit(10, 20);
  // Produces: LIMIT 20, 10 (in MySQL. Other
     databases have slightly different syntax)
Inserting Data
$data = array(
            'title' => 'My title' ,
            'name' => 'My Name' ,
            'date' => 'My date'
       );
$this->db->insert('mytable', $data);
  // Produces: INSERT INTO mytable (title, name, date)
     VALUES ('My title', 'My name', 'My date')
Updating Data
$data = array(
            'title' => $title,
            'name' => $name,
            'date' => $date
       );
$this->db->where('id', $id);
$this->db->update('mytable', $data);
  // Produces: UPDATE mytable SET title = '{$title}',
     name = '{$name}', date = '{$date}' WHERE id = $id
Deleting Data
$id = array('1', '2', '3');
$this->db->where_in('user_id', $id);
$this->db->delete('mytable');
// Produces: DELETE FROM mytable WHERE
   user_id in (1, 2, 3)
Exercise
Write news model which contains add_news,
 edit_news, update_news, get_last_entries
 function.
add_news($data), edit_news($data),
 update_news($data), get_last_entries($num)
Wirte Controller function to insert, update and
 select data with news model.
Scaffolding
It feature provides a fast and very convenient
   way to add, edit, or delete information in your
   database during development.
To set a secret word, open your
  application/config/routes.php file and look for
  this item:
  $route['scaffolding_trigger'] = '';
Enabling Scaffolding
<?php
class Blog extends Controller {
     function Blog()
     {
         parent::Controller();
         $this->load->scaffolding('table_name');
     }
}
?>
example.com/index.php/blog/abracadabra/
How to support it
繁體中文討論區
  http://ci.wuboy.twbbs.org/forum/
繁體中文線上文件
  http://ci.wuboy.twbbs.org/user_guide/
CI Wiki
  http://codeigniter.com/wiki/Special:Titles
酷學園討論區
  http://tinyurl.com/m8vjq7
PTT BBS PHP 討論版

Mais conteúdo relacionado

Mais procurados

Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Introduction to Play Framework
Introduction to Play FrameworkIntroduction to Play Framework
Introduction to Play FrameworkWarren Zhou
 
Hack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security TrainingHack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security TrainingColdFusionConference
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatRyan Weaver
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionJoe Ferguson
 
Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocketMing-Ying Wu
 
Web develop in flask
Web develop in flaskWeb develop in flask
Web develop in flaskJim Yeh
 
Web Development with NodeJS
Web Development with NodeJSWeb Development with NodeJS
Web Development with NodeJSRiza Fahmi
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpMatthew Davis
 
Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Vikas Chauhan
 
Python Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CIPython Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CIBruno Rocha
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Max Andersen
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Pavel Kaminsky
 
How to do everything with PowerShell
How to do everything with PowerShellHow to do everything with PowerShell
How to do everything with PowerShellJuan Carlos Gonzalez
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB
 

Mais procurados (20)

YouDrup_in_Drupal
YouDrup_in_DrupalYouDrup_in_Drupal
YouDrup_in_Drupal
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Introduction to Play Framework
Introduction to Play FrameworkIntroduction to Play Framework
Introduction to Play Framework
 
Hack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security TrainingHack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security Training
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
 
Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocket
 
Maven 3.0 at Øredev
Maven 3.0 at ØredevMaven 3.0 at Øredev
Maven 3.0 at Øredev
 
backend
backendbackend
backend
 
Web develop in flask
Web develop in flaskWeb develop in flask
Web develop in flask
 
Web Development with NodeJS
Web Development with NodeJSWeb Development with NodeJS
Web Development with NodeJS
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1
 
Python Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CIPython Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CI
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments
 
BPMS1
BPMS1BPMS1
BPMS1
 
Writing Pluggable Software
Writing Pluggable SoftwareWriting Pluggable Software
Writing Pluggable Software
 
How to do everything with PowerShell
How to do everything with PowerShellHow to do everything with PowerShell
How to do everything with PowerShell
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
 

Destaque

Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code IgniterAmzad Hossain
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniterschwebbie
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterJamshid Hashimi
 
CodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.comCodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.comChristopher Cubos
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkBo-Yi Wu
 
Desenvolvimento web com CodeIgniter
Desenvolvimento web com CodeIgniterDesenvolvimento web com CodeIgniter
Desenvolvimento web com CodeIgniterPedro Junior
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introductionCommit University
 
Codeigniter 3.0 之 30 分鐘就上手
Codeigniter 3.0 之 30 分鐘就上手Codeigniter 3.0 之 30 分鐘就上手
Codeigniter 3.0 之 30 分鐘就上手Piece Chao
 
Modular PHP Development using CodeIgniter Bonfire
Modular PHP Development using CodeIgniter BonfireModular PHP Development using CodeIgniter Bonfire
Modular PHP Development using CodeIgniter BonfireJeff Fox
 
You must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryYou must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryBo-Yi Wu
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterPongsakorn U-chupala
 
REST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterREST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterSachin G Kulkarni
 
CodeIgniter Class Reference
CodeIgniter Class ReferenceCodeIgniter Class Reference
CodeIgniter Class ReferenceJamshid Hashimi
 
Conceitos de Criptografia e o protocolo SSL - Elgio Schlemer
Conceitos de Criptografia e o protocolo SSL - Elgio SchlemerConceitos de Criptografia e o protocolo SSL - Elgio Schlemer
Conceitos de Criptografia e o protocolo SSL - Elgio SchlemerTchelinux
 
Infoeste 2014 - Desenvolvimento de um CMS com Codeigniter Framework(PHP)
Infoeste 2014 - Desenvolvimento de um CMS com Codeigniter Framework(PHP)Infoeste 2014 - Desenvolvimento de um CMS com Codeigniter Framework(PHP)
Infoeste 2014 - Desenvolvimento de um CMS com Codeigniter Framework(PHP)Rafael Oliveira
 
Php and database functionality
Php and database functionalityPhp and database functionality
Php and database functionalitySayed Ahmed
 
Minicurso code igniter aula 2
Minicurso code igniter   aula 2Minicurso code igniter   aula 2
Minicurso code igniter aula 2lfernandomcj
 
Mini-curso codeIgniter - aula 1
Mini-curso codeIgniter - aula 1Mini-curso codeIgniter - aula 1
Mini-curso codeIgniter - aula 1lfernandomcj
 
Linguagem de Programação Comercial
Linguagem de Programação ComercialLinguagem de Programação Comercial
Linguagem de Programação ComercialTathiana Machado
 

Destaque (20)

Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
 
CodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.comCodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.com
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
 
Desenvolvimento web com CodeIgniter
Desenvolvimento web com CodeIgniterDesenvolvimento web com CodeIgniter
Desenvolvimento web com CodeIgniter
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
 
Codeigniter 3.0 之 30 分鐘就上手
Codeigniter 3.0 之 30 分鐘就上手Codeigniter 3.0 之 30 分鐘就上手
Codeigniter 3.0 之 30 分鐘就上手
 
Modular PHP Development using CodeIgniter Bonfire
Modular PHP Development using CodeIgniter BonfireModular PHP Development using CodeIgniter Bonfire
Modular PHP Development using CodeIgniter Bonfire
 
You must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryYou must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular Library
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniter
 
REST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterREST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in Codeigniter
 
CodeIgniter Class Reference
CodeIgniter Class ReferenceCodeIgniter Class Reference
CodeIgniter Class Reference
 
Conceitos de Criptografia e o protocolo SSL - Elgio Schlemer
Conceitos de Criptografia e o protocolo SSL - Elgio SchlemerConceitos de Criptografia e o protocolo SSL - Elgio Schlemer
Conceitos de Criptografia e o protocolo SSL - Elgio Schlemer
 
Infoeste 2014 - Desenvolvimento de um CMS com Codeigniter Framework(PHP)
Infoeste 2014 - Desenvolvimento de um CMS com Codeigniter Framework(PHP)Infoeste 2014 - Desenvolvimento de um CMS com Codeigniter Framework(PHP)
Infoeste 2014 - Desenvolvimento de um CMS com Codeigniter Framework(PHP)
 
Php and database functionality
Php and database functionalityPhp and database functionality
Php and database functionality
 
Minicurso code igniter aula 2
Minicurso code igniter   aula 2Minicurso code igniter   aula 2
Minicurso code igniter aula 2
 
Mini-curso codeIgniter - aula 1
Mini-curso codeIgniter - aula 1Mini-curso codeIgniter - aula 1
Mini-curso codeIgniter - aula 1
 
Linguagem de Programação Comercial
Linguagem de Programação ComercialLinguagem de Programação Comercial
Linguagem de Programação Comercial
 

Semelhante a CodeIgniter PHP MVC Framework Guide

Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolGordon Forsythe
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationAbdul Malik Ikhsan
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...LEDC 2016
 
Migrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindMigrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindValentine Matsveiko
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroChristopher Pecoraro
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentBrad Williams
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Mike Schinkel
 
Getting to The Loop - London Wordpress Meetup July 28th
Getting to The Loop - London Wordpress Meetup  July 28thGetting to The Loop - London Wordpress Meetup  July 28th
Getting to The Loop - London Wordpress Meetup July 28thChris Adams
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress developmentSteve Mortiboy
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Phpfunkatron
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Michelangelo van Dam
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Dilouar Hossain
 
Cakephp's Cache
Cakephp's CacheCakephp's Cache
Cakephp's Cachevl
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Michelangelo van Dam
 

Semelhante a CodeIgniter PHP MVC Framework Guide (20)

Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
 
Migrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindMigrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mind
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher Pecoraro
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
WebGUI Developers Workshop
WebGUI Developers WorkshopWebGUI Developers Workshop
WebGUI Developers Workshop
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 
Getting to The Loop - London Wordpress Meetup July 28th
Getting to The Loop - London Wordpress Meetup  July 28thGetting to The Loop - London Wordpress Meetup  July 28th
Getting to The Loop - London Wordpress Meetup July 28th
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
 
Cakephp's Cache
Cakephp's CacheCakephp's Cache
Cakephp's Cache
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
 

Mais de Bo-Yi Wu

Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Bo-Yi Wu
 
用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構Bo-Yi Wu
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in GolangBo-Yi Wu
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and PracticeBo-Yi Wu
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub ActionsBo-Yi Wu
 
Drone 1.0 Feature
Drone 1.0 FeatureDrone 1.0 Feature
Drone 1.0 FeatureBo-Yi Wu
 
Drone CI/CD Platform
Drone CI/CD PlatformDrone CI/CD Platform
Drone CI/CD PlatformBo-Yi Wu
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN GolangBo-Yi Wu
 
Go 語言基礎簡介
Go 語言基礎簡介Go 語言基礎簡介
Go 語言基礎簡介Bo-Yi Wu
 
drone continuous Integration
drone continuous Integrationdrone continuous Integration
drone continuous IntegrationBo-Yi Wu
 
Gorush: A push notification server written in Go
Gorush: A push notification server written in GoGorush: A push notification server written in Go
Gorush: A push notification server written in GoBo-Yi Wu
 
用 Drone 打造 輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台用 Drone 打造輕量級容器持續交付平台
用 Drone 打造 輕量級容器持續交付平台Bo-Yi Wu
 
用 Go 語言 打造微服務架構
用 Go 語言打造微服務架構用 Go 語言打造微服務架構
用 Go 語言 打造微服務架構Bo-Yi Wu
 
Introduction to Gitea with Drone
Introduction to Gitea with DroneIntroduction to Gitea with Drone
Introduction to Gitea with DroneBo-Yi Wu
 
運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率Bo-Yi Wu
 
用 Go 語言實戰 Push Notification 服務
用 Go 語言實戰 Push Notification 服務用 Go 語言實戰 Push Notification 服務
用 Go 語言實戰 Push Notification 服務Bo-Yi Wu
 
用 Go 語言打造 DevOps Bot
用 Go 語言打造 DevOps Bot用 Go 語言打造 DevOps Bot
用 Go 語言打造 DevOps BotBo-Yi Wu
 
A painless self-hosted Git service: Gitea
A painless self-hosted Git service: GiteaA painless self-hosted Git service: Gitea
A painless self-hosted Git service: GiteaBo-Yi Wu
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golangBo-Yi Wu
 
用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式Bo-Yi Wu
 

Mais de Bo-Yi Wu (20)

Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
 
用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構用 Go 語言打造多台機器 Scale 架構
用 Go 語言打造多台機器 Scale 架構
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and Practice
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
 
Drone 1.0 Feature
Drone 1.0 FeatureDrone 1.0 Feature
Drone 1.0 Feature
 
Drone CI/CD Platform
Drone CI/CD PlatformDrone CI/CD Platform
Drone CI/CD Platform
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
 
Go 語言基礎簡介
Go 語言基礎簡介Go 語言基礎簡介
Go 語言基礎簡介
 
drone continuous Integration
drone continuous Integrationdrone continuous Integration
drone continuous Integration
 
Gorush: A push notification server written in Go
Gorush: A push notification server written in GoGorush: A push notification server written in Go
Gorush: A push notification server written in Go
 
用 Drone 打造 輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台用 Drone 打造輕量級容器持續交付平台
用 Drone 打造 輕量級容器持續交付平台
 
用 Go 語言 打造微服務架構
用 Go 語言打造微服務架構用 Go 語言打造微服務架構
用 Go 語言 打造微服務架構
 
Introduction to Gitea with Drone
Introduction to Gitea with DroneIntroduction to Gitea with Drone
Introduction to Gitea with Drone
 
運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率
 
用 Go 語言實戰 Push Notification 服務
用 Go 語言實戰 Push Notification 服務用 Go 語言實戰 Push Notification 服務
用 Go 語言實戰 Push Notification 服務
 
用 Go 語言打造 DevOps Bot
用 Go 語言打造 DevOps Bot用 Go 語言打造 DevOps Bot
用 Go 語言打造 DevOps Bot
 
A painless self-hosted Git service: Gitea
A painless self-hosted Git service: GiteaA painless self-hosted Git service: Gitea
A painless self-hosted Git service: Gitea
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式
 

Último

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 

Último (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

CodeIgniter PHP MVC Framework Guide

  • 1. CodeIgniter PHP MVC Framwork OSSF, 自由軟體鑄造場 ,Who's Who 吳柏毅 appleboy@OpenFoundry workshop
  • 2. Taiwan Community http://phorum.study-area.org/ 酷 ! 學園 http://www.openfoundry.org/ OSSF, 自由軟體 鑄造場 http://whoswho.openfoundry.org/forum.html Who's Who
  • 3. Who am I? I am appleboy (My nick name) 吳柏毅 Google appleboy keyword Blog: http://blog.wu-boy.com 酷學園: appleboy Ptt BBS: appleboy46 Twitter: appleboy Plurk: appleboy46
  • 4. CodeIgniter Taiwan Community Irc: Freenode #CodeIgniter.tw http://ci.wuboy.twbbs.org/ 台灣官方網站 http://ci.wuboy.twbbs.org/forum/ 繁體中文討論區 http://ci.wuboy.twbbs.org/user_guide/ 繁體中文文件
  • 5. Popular PHP MVC Framework Zend Framework CakePHP Symfony ( 少數 ) CodeIgniter ( 少數 ) Kohana was forked from CodeIgniter 1.5.4 in 2007 (support php5)
  • 6. PHP Web Framework Performance ZendFramework, CodeIgniter, CakePHP With APC PHP code cache Url : http://avnetlabs.com/php/php-framework- comparison-benchmarks
  • 7. Why Gallery3 use Kohana Framework Kohana was forked from CodeIgniter 1.5.4 in 2007. It base on PHP5. Zend Framework is 1705 files of framework code. It is 200-300% slower. ZF docs are comprehensive, but overwhelming and lacking in good examples making ZF development a very frustrating experience. CodeIgniter doesn't support exceptions, but Kohana has slightly worse performance than CI.
  • 8. CodeIgniter is right for you if: You want a framework that does not require you to use the command line. You want a framework with a small footprint. You need exceptional performance. You need clear, thorough documentation.
  • 9. CodeIgniter Features Model-View-Controller Based System PHP 4 Compatible Active Record Database Support Form and Data Validation Security and XSS Filtering Pagination Scaffolding Cache Large library of "helper" functions
  • 11. Model-View-Controller Model: help you retrieve, insert, and update information in your database. View: the information that is being presented to a user. Controller: an intermediary between the Model, the View any other resources needed to process the HTTP request and generate a web page
  • 12. How to install it ? It is very easy Install Apache + PHP + MySQL ( Appserv ) Download CodeIgniter 1.7.1 Unzip it, and move CI directory to www Open your browser http://127.0.0.1
  • 16. How to create multiple project Edit index.php $application_folder = "application"; $system_folder = "system"; Move CI Core to www.
  • 17. Exercise Create two project. Foo Bar Use common CI Core If you want upgrade CI, you can replace CI Core directory.
  • 18. Initial Configuration: config.php system/application/config/ $config['base_url'] = 'http://localhost/'; $config['index_page'] = ''; To make this work, you need to include an .htaccess file to the CodeIgniter root directory.
  • 19. default settings $config['charset'] = “UTF-8”; $config['cache_path'] = ''; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-'; $config['log_date_format'] = 'Y-m-d H:i:s'; $config['global_xss_filtering'] = TRUE;
  • 20. CodeIgniter URLs example.com/index.php/news/article/my_article news – Controller article – class function my_article - any additional segments If you do not use CodeIgniter, your urls is: example.com/news.php?mode=show&id=1
  • 21. Removing the index.php file (Apache) By default, the index.php file will be included in your URLs: example.com/index.php/news/article/my_article using a .htaccess file with some simple rules Edit httpd.conf Unmark LoadModule rewrite_module modules/mod_rewrite.so RewriteEngine on RewriteCond $1 !^(index.php|images|robots.txt) RewriteRule ^(.*)$ /index.php/$1 [L]
  • 22. Removing the index.php file (Lighttpd) Edit lighttpd.conf
  • 23. Adding a URL Suffix Edit config/config.php file example.com/index.php/products/view/shoes example.com/index.php/products/view/shoes.htm l
  • 24. Enabling Query Strings In some cases you might prefer to use query strings URLs: index.php?c=products&m=view&id=345 index.php?c=controller&m=method $config['enable_query_strings'] = FALSE; $config['controller_trigger'] = 'c'; $config['function_trigger'] = 'm'; Reduce the google search keywords
  • 25. What is a Controller? example.com/index.php/blog/ Then save the file to your application/controllers/ folder
  • 26. Controller Class names must start with an uppercase letter. In other words class Blog extends Controller { }
  • 29. Passing URI Segments to your Functions example.com/index.php/products/shoes/sandals/ 123
  • 30. Defining a Default Controller open your application/config/routes.php file and set this variable: $route['default_controller'] = 'Blog';
  • 31. URI Routing: routes.php Routing rules are defined in your application/config/routes.php file example.com/class/function/id/ http://www.example.com/site/pages/4 http://www.example.com/about_us/ $route['about_us'] = “site/pages/4”; $route['blog/joe'] = "blogs/users/34";
  • 32. Regular Expressions $route['products/([a-z]+)/(d+)'] = "$1/id_$2"; $route['default_controller'] = 'welcome';
  • 34. Exercise Remote index.php with url. Write controller News News contains showNewsList and showNews function. Use $this->$method(); to call showNewsList and showNews function in index function, then echo 『 hello world 』。 Set upload directory value in Class Constructors $this->upload_folder = 'upload/news/';
  • 35. Creating a View save the file in your application/views/ folder <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>My Blog</title> </head> <body> <h1>Welcome to my Blog!</h1> </body> </html>
  • 36. Loading a View $this->load->view('name'); example.com/index.php/blog/ <?php class Blog extends Controller { function index() { $this->load->view('blogview'); } } ?>
  • 37. Loading multiple views <?php class Blog extends Controller { function index() { $data['page_title'] = 'Your title'; $this->load->view('header'); $this->load->view('menu'); $this->load->view('content', $data); $this->load->view('footer'); } } ?>
  • 38. Storing Views within Sub-folders $this->load->view('folder_name/file_name'); folder_name is Controller name
  • 39. Adding Dynamic Data to the View You can use an array or an object in the second parameter of the view loading function. $data = array( 'title' => 'My Title', 'heading' => 'My Heading', 'message' => 'My Message' ); $this->load->view('blogview', $data); $data = new Someclass(); $this->load->view('blogview', $data);
  • 40. example <?php class Blog extends Controller { function index() { $data['title'] = "My Real Title"; $data['heading'] = "My Real Heading"; $this->load->view('blogview', $data); } } ?>
  • 41. Creating Loops: Controller <?php class Blog extends Controller { function index() { $data['todo_list'] = array('Clean House', 'Call Mom', 'Run Errands'); $data['title'] = "My Real Title"; $data['heading'] = "My Real Heading"; $this->load->view('blogview', $data); } } ?>
  • 42. Creating Loops: view <html> <head> <title><?php echo $title;?></title> </head> <body> <h1><?php echo $heading;?></h1> <h3>My Todo List</h3> <ul> <?php foreach($todo_list as $item):?> <li><?php echo $item;?></li> <?php endforeach;?> </ul> </body> </html>
  • 43. Returning views as data $string = $this->load->view('myfile', '', true); When to use it?
  • 44. Exercise Create application/views/header.php and footer.php 傳入任意值 n, m 到 function number($num_1, $num_2) ,輸出 n*1 ~n*m, output file application/views/output/index.php example.com/output/number/6/5 example.com/output/number/10/4
  • 45. Helper Functions $this->load->helper('name'); to load the URL Helper file, which is named url_helper.php, you would do this: $this->load->helper('url');
  • 46. Loading Multiple Helpers $this->load->helper( array('helper1', 'helper2', 'helper3'));
  • 47. How to Auto-loading Helpers? To autoload resources, open the application/config/autoload.php file and add the item you want loaded to the autoload array $autoload['libraries'] = array('database','session','email','validation'); $autoload['helper'] = array('url','form','text','date','security'); $autoload['plugin'] = array('captcha'); $autoload['model'] = array(); $autoload['config'] = array();
  • 48. Text Helper $string = "Here is a nice text"; $string = word_limiter($string, 4); // for English URL Helper base_url() anchor('news/local/123', 'My News'); Email Helper valid_email('email'); //return true/false send_email('recipient', 'subject', 'message')
  • 49. CodeIgniter Libraries Language Class Input and Security Class Pagination Class Session Class URI Class Email Class Form Validation Class
  • 50. Using CodeIgniter Libraries $this->load->library('class name'); Email Class $this->load->library('email'); $this->load->library('email'); $this->email->from('your@example.com', 'Your Name'); $this->email->to('someone@example.com'); $this->email->cc('another@another-example.com'); $this->email->bcc('them@their-example.com'); $this->email->subject('Email Test'); $this->email->message('Testing the email class.'); $this->email->send();
  • 51. Input and Security Class Do not use isset $this->input->post('some_data'); The function returns FALSE (boolean) if the item you are attempting to retrieve does not exist. $this->input->post('some_data', TRUE); $this->input->get('some_data', TRUE); $this->input->get_post('some_data', TRUE);
  • 52. Form Validation Setting Validation Rules $this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[12]'); $this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]'); $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required'); $this->form_validation->set_rules('email', 'Email', 'required| valid_email');
  • 53. Form Validation Controller $this->form_validation->run(); return true / false Show error message <?=validation_errors();?> // add view html <?=form_error('user_name'); ?>
  • 55. Creating Libraries Your library classes should be placed within your application/libraries folder File names must be capitalized. For example: Myclass.php Class declarations must be capitalized. For example: class Myclass Class names and file names must match.
  • 56. The Class File <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Someclass { function display_error() { } function ErrMsg() { } } ?>
  • 57. Using Your Class $this->load->library('someclass'); Once loaded you can access your class using the lower case version: $this->someclass->some_function(); // Object instances will always be lower case
  • 58. Utilizing CodeIgniter Resources within Your Library $this->load->helper('url'); $this->load->library('session'); $this->config->item('base_url'); $this, only works directly within your controllers, your models, or your views.
  • 59. If you would like to use CodeIgniter's classes from within your own custom classes you can do so as follows: First, assign the CodeIgniter object to a variable: $CI =& get_instance(); $CI->load->helper('url'); $CI->load->library('session');
  • 60. Exercise Write your own Library and edit autoload.php file to auto load it. Write library class system_message, and it contains ErrMsg function. <script language=”javascript”> alert(“hello world”); history.go(-1); </script> Add another function.
  • 61. What is a Model? model class that contains functions to insert, update, and retrieve your data. Model classes are stored in your application/models/ folder. Example: application/models/user_model.php class User_model extends Model { function User_model() { parent::Model(); } }
  • 62. Loading a Model $this->load->model('Model_name'); if you have a model located at application/models/blog/queries.php you'll load it using: $this->load->model('blog/queries'); Auto-loading: Edit application/config/autoload.php
  • 63. Example: controller loads a model class Blog extends Controller { function index() { $this->load->model('Blog'); $data['query'] = $this->Blog->get_last_ten_entries(); $this->load->view('blog', $data); } }
  • 64. Database Configuration Edit: application/config/database.php $db['default']['hostname'] = "localhost"; $db['default']['username'] = "root"; $db['default']['password'] = ""; $db['default']['database'] = "database_name"; $db['default']['dbdriver'] = "mysql"; $db['default']['dbprefix'] = ""; $db['default']['pconnect'] = FALSE; $db['default']['cache_on'] = FALSE;
  • 65. Database Configuration $active_group = "default"; $active_record = TRUE;
  • 66. Queries Original: $result = mysql_query($sql) or die (mysql_error()); CI: $query = $this->db->query('YOUR QUERY HERE'); $sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?"; $this->db->query($sql, array(3, 'live', 'Rick')); Escaping Queries $this->db->escape($title);
  • 67. Generating Query Results Result():This function returns the query result as an array of objects, or an empty array on failure. single result row: $query->row(); $query = $this->db->query("YOUR QUERY"); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { echo $row->title; echo $row->name; echo $row->body; } }
  • 68. Generating Query Results result_array(): single result row: $query->row_array(); $query = $this->db->query("YOUR QUERY"); foreach ($query->result_array() as $row) { echo $row['title']; echo $row['name']; echo $row['body']; }
  • 69. Result Helper Functions $query->num_rows() $query->free_result() $this->db->insert_id() $this->db->count_all(); echo $this->db->count_all('my_table'); $this->db->insert_string(); $data = array('name' => $name, 'email' => $email, 'url' => $url); $str = $this->db->insert_string('table_name', $data);
  • 70. Result Helper Functions $this->db->update_string(); $data = array('name' => $name, 'email' => $email, 'url' => $url); $where = "author_id = 1 AND status = 'active'"; $str = $this->db->update_string('table_name', $data, $where);
  • 71. Active Record Class It allows information to be retrieved, inserted, and updated in your database with minimal scripting. It also allows for safer queries, since the values are escaped automatically by the system
  • 72. Selecting Data $query = $this->db->get('mytable'); Produces: SELECT * FROM mytable $query = $this->db->get('mytable', 10, 20); Produces: SELECT * FROM mytable LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)
  • 73. Selecting Data $this->db->select('title, content, date'); $query = $this->db->get('mytable'); // Produces: SELECT title, content, date FROM mytable
  • 74. Selecting Data $this->db->select_max('age', 'member_age'); // Produces: SELECT MAX(age) as member_age FROM members $this->db->select_min('age'); $this->db->select_avg('age'); $this->db->select_sum();
  • 75. Selecting Data $this->db->select('title, content, date'); $this->db->from('mytable'); $query = $this->db->get(); // Produces: SELECT title, content, date FROM mytable
  • 76. Select join $this->db->join('comments', 'comments.id = blogs.id', 'left'); // Produces: LEFT JOIN comments ON comments.id = blogs.id Options are: left, right, outer, inner, left outer, and right outer.
  • 77. $this->db->where('name', $name); // Produces: WHERE name = 'Joe' $this->db->where('name', $name); $this->db->where('status', $status); // WHERE name 'Joe' AND status = 'active' $this->db->where('name !=', $name); $this->db->where('id <', $id); // Produces: WHERE name != 'Joe' AND id < 45 $array = array('name !=' => $name, 'id <' => $id, 'date >' => $date); $this->db->where($array); $where = "name='Joe' AND status='boss' OR status='active'"; $this->db->where($where);
  • 78. $this->db->where('name !=', $name); $this->db->or_where('id >', $id); // Produces: WHERE name != 'Joe' OR id > 50 $names = array('Frank', 'Todd', 'James'); $this->db->where_in('username', $names); // Produces: WHERE username IN ('Frank', 'Todd', 'James') $names = array('Frank', 'Todd', 'James'); $this->db->or_where_in('username', $names); // Produces: OR username IN ('Frank', 'Todd', 'James') $this->db->where_not_in(); $this->db->or_where_not_in();
  • 79. $this->db->like('title', 'match', 'before'); // Produces: WHERE title LIKE '%match' $this->db->like('title', 'match', 'after'); // Produces: WHERE title LIKE 'match%' $this->db->like('title', 'match', 'both'); // Produces: WHERE title LIKE '%match%' $this->db->like('title', 'match'); $this->db->or_like('body', $match); // WHERE title LIKE '%match%' OR body LIKE '%match%' $this->db->not_like(); $this->db->or_not_like();
  • 80. $this->db->group_by(array("title", "date")); // Produces: GROUP BY title, date $this->db->order_by("title", "desc"); // Produces: ORDER BY title DESC $this->db->order_by('title desc, name asc'); // Produces: ORDER BY title DESC, name ASC $this->db->order_by("title", "desc"); $this->db->order_by("name", "asc"); // Produces: ORDER BY title DESC, name ASC $this->db->limit(10, 20); // Produces: LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)
  • 81. Inserting Data $data = array( 'title' => 'My title' , 'name' => 'My Name' , 'date' => 'My date' ); $this->db->insert('mytable', $data); // Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
  • 82. Updating Data $data = array( 'title' => $title, 'name' => $name, 'date' => $date ); $this->db->where('id', $id); $this->db->update('mytable', $data); // Produces: UPDATE mytable SET title = '{$title}', name = '{$name}', date = '{$date}' WHERE id = $id
  • 83. Deleting Data $id = array('1', '2', '3'); $this->db->where_in('user_id', $id); $this->db->delete('mytable'); // Produces: DELETE FROM mytable WHERE user_id in (1, 2, 3)
  • 84. Exercise Write news model which contains add_news, edit_news, update_news, get_last_entries function. add_news($data), edit_news($data), update_news($data), get_last_entries($num) Wirte Controller function to insert, update and select data with news model.
  • 85. Scaffolding It feature provides a fast and very convenient way to add, edit, or delete information in your database during development. To set a secret word, open your application/config/routes.php file and look for this item: $route['scaffolding_trigger'] = '';
  • 86. Enabling Scaffolding <?php class Blog extends Controller { function Blog() { parent::Controller(); $this->load->scaffolding('table_name'); } } ?> example.com/index.php/blog/abracadabra/
  • 87. How to support it 繁體中文討論區 http://ci.wuboy.twbbs.org/forum/ 繁體中文線上文件 http://ci.wuboy.twbbs.org/user_guide/ CI Wiki http://codeigniter.com/wiki/Special:Titles 酷學園討論區 http://tinyurl.com/m8vjq7 PTT BBS PHP 討論版