about 10 years ago

[環境建置]

安裝Appserv 注意事項

( 安裝完Appserv後就會有 Apache Http Server、PHP、MySQL、phpMyAdmin )
MySQL Server Configuration

  • 記住輸入的密碼 (之後登phpMyAdmin的帳號是root 密碼就是這裡輸入的)
  • 不要勾選 Old Password Support
  • 勾選 Enable InnoDB 安裝成功輸入 http://localhost 進入phpMyAdmin時一片空白 => 解決方式

在Win7底下設置好環境後,我的CI目錄是在 AppServ/www/CodeIgniter 之中
CodeIgniter 底下主要有

  • application/
  • system/
  • user_guide/
  • welcome/
  • index.php
  • license.txt

對CodeIgniter來說我的baseurl就是就是: http://localhost/CodeIgniter

[參考] 以下都是中文!!!

CodeIgniter (1) - 導論:介紹CodeIgniter、Framework、MVC 的概念。
OSSF 自由軟體鑄造場工作坊 CodeIgniter 2.0.X 講課投影片:從CodeIgniter導讀,到建置、各種練習,內容很豐富的投影片
CodeIgniter 使用手冊版本 2.1.4:CodeIgniter 詳細使用手冊

[View 練習]

  • 新增 CodeIgniter/application/controllers/blog.php

    <?php
    class Blog extends CI_Controller {
        public function index()
        {
                $data = array(
                        'title' => 'My Title',
                        'heading' => 'My Heading',
                        'message' => 'My Message'
                );
                $this->load->view('blogview',$data);
        }
    }
    ?>
    

    雖然名稱是blog.php,但class名稱是大寫 Blog

  • 新增 CodeIgniter/application/views/blogview.php

    <html>
    <head>
    <title><?php echo $title;?></title>
    </head>
    <body>
        <h1><?php echo $heading;?></h1>
        <hr>
        <div><?php echo $message;?></div>
    </body>
    </html>
    
  • 瀏覽器輸入 localhost/CodeIgniter/index.php/blog

[Input 練習] demo

  • 新增 CodeIgniter/application/controllers/test.php
    <?php
    class Test extends CI_Controller {
        public function index()
        {
                $temp = $this->input->get__post('title',TRUE);
                echo $temp;
        }
    }
    ?>
    
  • 瀏覽器輸入 localhost/CodeIgniter/index.php/blog/?title=想呈現的字串
← 2013 summer 新的里程碑 [入手] j5Create Ultra Station (JUD500)、Timbuk2 D-Lux Messenger (S) →
 
comments powered by Disqus