简体   繁体   English

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

[英]Codeigniter tutorial static page.. using Bitnami WAMP

Am trying Elisa Labs CodeIgniter tutorials. 我正在尝试Elisa Labs CodeIgniter教程。 But am stuck with the first lesson itself. 但是,第一堂课本身就让我感到困惑。 Ref: https://www.codeigniter.com/user_guide/tutorial/static_pages.html 参考: 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 . 但是我无法在浏览器中以localhost / index.php / pages / view的形式查看它们。 I get 404 error. 我收到404错误。 I'm using Bitnami WAMP. 我正在使用Bitnami WAMP。 I get the default codeignitor welcome page at localhost. 我在localhost获得默认的codeignitor欢迎页面。 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 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 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);

    }


}

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. Bitnami的WAMP堆栈配置为在Apache的默认Web文件夹中启动。 Additional applications and frameworks can be added on to the stack as Bitnami apps. 可以将其他应用程序和框架作为Bitnami应用程序添加到堆栈中。

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. Bitnami配置位于: <path_to_WAMP>\\apache2\\conf\\bitnami在此目录中,有一个名为bitnami-apps-prefix.conf的文件,其中包含所有已启用应用程序的路径。

To get codeigniter working, I made two changes: 为了使codeigniter正常工作,我进行了两项更改:
1) I added the following line to the file, bitnami-apps-prefix.conf : 1)我bitnami-apps-prefix.conf添加到文件bitnami-apps-prefix.conf
Include "<path_to_WAMP>/frameworks/codeigniter/conf/httpd-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 2)由于我太懒惰(而且还是一个害怕的新手),无法更改Apache配置,因此我创建了一个快捷方式: <path_to_WAMP>\\apps\\codeigniter指向<path_to_WAMP>\\frameworks\\codeigniter

That's all it took to get the codeigniter examples running 这就是运行codeigniter示例所需的一切

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM