close

1.JPG

CodeIgniter這開放程式碼可參考[網頁技巧學習筆記]CodeIgniter套用,這裡會將CodeIgniter在XAMPP下執行,下載版本為CodeIgniter-3.1.6,將解完壓所檔放在路徑C:\xampp\htdocs,

9.JPG

來設定CodeIgniter-3.1.6執行位置,點選/Config/Apache(httpd.conf),如下所示,

27.jpg

在第251行到第252行C:/xampp/htdocs/後面增加要執行的CodeIgniter-3.1.6,如下所示,

28.JPG

儲存完成後,在XAMPP Control Panel開啟網頁,如下所示,

29.JPG

在路徑\CodeIgniter-3.1.6\application\controllers,開啟Welcome.php,裏頭有一段說明,

30.JPG

輸入網址http://localhost/index.php/welcome,順利執行網頁,

32.JPG

如果不加index.php會找不到物件,如下所示,

31.JPG

為了達到可省略index.php,需要在路徑\CodeIgniter-3.1.6增加.htaccess檔案,

34.JPG

裏頭要寫以下內容,

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

33.JPG

輸入網址http://localhost/welcome,順利執行網頁,

35.JPG

arrow
arrow
    文章標籤
    CodeIgniter XAMPP PHP
    全站熱搜

    鄭智遠 發表在 痞客邦 留言(0) 人氣()