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

    评论

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错