是“root web server”和localhost一样吗?安装CodeIgniter

问题描述 投票:0回答:1

我正在尝试安装CodeIgniter(我有Mac)。我没有Frameworks的经验,但我读过一些关于MVC的知识。我的目标是设置CodeIgnitor,以便我可以使用它。

所以我下载CodeIgniter,然后在一个教程中我告诉以下内容:将文件复制到服务器的web根文件夹,通常是/ var / www /!

在本教程中:http://www.phpeveryday.com/articles/CodeIgniter-Introduction-to-CodeIgniter-Framework-P147.html

我被告知要“打开你的根网络服务器”并将文件夹放在里面。

什么是“根网络服务器”?这是我的htdocs吗?我应该把这个文件夹放在哪里?

我将文件夹放入我的HTDOCS文件夹,因为那是所有PHP文件的所在,但我不确定我是否做得对。

php macos codeigniter
1个回答
0
投票

请安装世界上最简单的东西XAMPP

找到文件夹xampp/htdocs(所需的Web根文件夹)并在其中创建文件夹(项目名称),在那里解压缩/ unrar / un7z CI,这样你的文件夹结构将是

xampp/htdocs/project_name/application
                         /system
                         /index.php

打开project_name/application/config并通过所有文件一个接一个地看到它们,这样你就知道CI能做什么,不能做到这一点在每个文件中都能很好地解释每个设置的作用。

如果您是CI的新手,请关注此video tutorial


如果你正在寻找好的.htaccess文件抓住这个并根据你的需要进行更改

注意:此文件应位于/ project_name中

注2:也在config/config.phpindex_page设为$config['index_page'] = '';

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /<your project name>

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # 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
</IfModule>

改变.htaccessconfig/config.php之后你的网址是“好的”localhost/project_name/controller/method/parameter1/parameter2

最后:它不是CodeIgniter 笨

© www.soinside.com 2019 - 2024. All rights reserved.