肥健的PHP歷程

呵! 呢度係肥健建立o既. 目的係幫我記下日常編寫PHP時O既問題同埋心得. 為目標而加油吧!

Sunday, February 15, 2009

CodeIgniter 起手式(1)

咁做Development梗係貪用MS OS 0既, 用開又方便嘛.

例牌用Xampp行, 無奈CI 要 用index.php 做 default controller, 換言之要: http://localhost/ci2/index.php/$functions. 煩死得0黎又唔好睇

梗係變做 localhost/ci2/$function 就ok 啦...well...
  1. Confirm Xampp 行緊mod_rewrite
  2. 在ci2 的base 用 cmd mode generate 個吉的 .htaccess (檔案總管會孖叉0既)
  3. 加入以下東西到 .htaccess:
    Options FollowSymLinks

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]



    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
  4. config/config.php 中修改兩項:
    $config['base_url'] = "http://localhost/$ci2Path/"
    $config['index_page'] = "";
穩陣d 梗係行 xampp_restart 睇下次成唔成功啦

Labels:

0 Comments:

Post a Comment

<< Home