douxi3404 2014-03-22 08:32
浏览 65

Codeigniter教程静态页面..使用Bitnami WAMP

Am trying Elisa Labs CodeIgniter tutorials. But am stuck with the first lesson itself. Ref: https://www.codeigniter.com/user_guide/tutorial/static_pages.html

As mentioned in the code I've created the controller and view. But I'm not able to view them in the browser as localhost/index.php/pages/view . I get 404 error. I'm using Bitnami WAMP. I get the default codeignitor welcome page at localhost. How can I access the newly created controller and view?

Please can any one help me with this?

More Details.

Content of C:\Bitnami\wampstack-5.4.25-1\frameworks\codeigniter\conf\httpd-prefix.conf

 # Alias /codeigniter/ "C:\Bitnami\wampstack-5.4.25-1/frameworks/codeigniter/htdocs/"

 # Alias /codeigniter "C:\Bitnami\wampstack-5.4.25-1/frameworks/codeigniter/htdocs"

 # Alias /test "C:\Bitnami\wampstack-5.4.25-1/frameworks/codeigniter/htdocs"

 # Alias /test/ "C:\Bitnami\wampstack-5.4.25-1/frameworks/codeigniter/htdocs"

DocumentRoot "C:\Bitnami\wampstack-5.4.25-1/frameworks/codeigniter/htdocs"

Include "C:\Bitnami\wampstack-5.4.25-1/frameworks/codeigniter/conf/httpd-app.conf"

Content of C:\Bitnami\wampstack-5.4.25-1\frameworks\codeigniter\application\controllers\pages.php

class Pages extends CI_Controller {

public function view($page = 'home')
{

if ( ! file_exists('application/views/pages/'.$page.'.php'))
{
    // Whoops, we don't have a page for that!
    show_404();
}

$data['title'] = ucfirst($page); // Capitalize the first letter

$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);

    }


}
  • 写回答

1条回答 默认 最新

  • doudao1369 2014-08-12 03:28
    关注

    I recently ran into the same issue, and discovered the solution after tinkering for some time. Bitnami's WAMP stack is configured to start in Apache's default web folder. Additional applications and frameworks can be added on to the stack as Bitnami apps.

    The Bitnami configuration is located in: <path_to_WAMP>\apache2\conf\bitnami In this directory, there is a file named bitnami-apps-prefix.conf which contains the paths to all enabled applications.

    To get codeigniter working, I made two changes:
    1) I added the following line to the file, bitnami-apps-prefix.conf:
    Include "<path_to_WAMP>/frameworks/codeigniter/conf/httpd-prefix.conf"; and
    2) Since I was too lazy (and also a scared newbie) to alter Apache configurations, I created a shortcut: <path_to_WAMP>\apps\codeigniter that points to <path_to_WAMP>\frameworks\codeigniter

    That's all it took to get the codeigniter examples running

    评论

报告相同问题?

悬赏问题

  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)