午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    內容管理demo之route controllers-CI(codeigniter)PHP框架
    來源:易賢網 閱讀:1057 次 日期:2014-09-10 10:34:58
    溫馨提示:易賢網小編為您整理了“內容管理demo之route controllers-CI(codeigniter)PHP框架”,方便廣大網友查閱!

    學習codeigniter幾天后,根據前面學習的做了一個簡單的demo,內容管理,很簡單,順便把前面的復習一下 ,本文是route路徑和controllers 內容

    route路徑內容

    $route['news'] = 'news/index';

    $route['news/(:num)'] = 'news/index/$1';

    $route['news/(:any)'] = 'news/$1';

    controllers 的內容

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    class News extends CI_Controller {

    public function __construct(){

    parent::__construct();

    $this->load->model('news_model');

    }

    public function index($pn=1)

    {

    $data['news']=$this->news_model->get_news($pn);

    $data['title'] = '新聞列表';

    $this->load->view('news/index.html', $data);

    }

    public function show($id){

    }

    public function add(){

    $this->load->view('news/add.html');

    }

    public function addaction(){//這里采用的是 定義的{}模板符

    $this->load->library('parser');

    if($this->news_model->addaction()){

    $data['message']="添加成功!";

    }else{

    $data['message'] ="添加失敗" ;

    }

    $this->parser->parse("message.html",$data);

    }

    public function change($id){

    $data = $this->news_model->get_news_id($id);

    if($data){

    $this->load->view('news/change.html',$data);

    }else{

    $this->load->view('message.html','沒有該新聞或者參數(shù)錯誤!');

    }

    }

    public function changeaction($id){

    $this->load->library('parser');

    if($this->news_model->changeaction($id)){

    $data['message'] ='修改成功!';

    }else{

    $data['message'] ='修改失敗!';

    }

    $this->parser->parse("message.html",$data);

    // redirect('/login/form/', 'refresh');

    }

    }

    這里是兩個模塊內容。

    更多信息請查看IT技術專欄

    更多信息請查看網絡編程

    2025國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關于我們 | 聯(lián)系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網