php 运行 CodeIgniter 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16515260/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Running CodeIgniter Project
提问by Dimitri
I have a Whole web site project based on CodeIgniter framework. My problem is i don't know how to run this project on my local Mamp Server. I have Successfully set up Mamp and Also run the latest version of CodeIgniter.
我有一个基于 CodeIgniter 框架的整个网站项目。我的问题是我不知道如何在本地 Mamp 服务器上运行这个项目。我已成功设置 Mamp 并运行最新版本的 CodeIgniter。
But now how can i run the whole project using CodeIgniter found in my localhost folder. This is my first experience with a CMS Framework.
但是现在我如何使用在我的 localhost 文件夹中找到的 CodeIgniter 运行整个项目。这是我第一次使用 CMS 框架。
采纳答案by Yasir Ahmed
Open application/config folder
打开应用程序/配置文件夹
First go to config.php file and point the base url to the correct location
$config['base_url'] = '';
than goes to the database.php and provide correct database parameters
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user';
$db['default']['password'] = 'password';
$db['default']['database'] = 'dbname';thats the most basic changes u have to do....
now if you want to redirect it to specific controller by default go to routes.php file in config directory and change this vairable $route['default_controller'] = "yourcontrollername"
首先转到 config.php 文件并将基本 url 指向正确的位置
$config['base_url'] = '';
比去database.php并提供正确的数据库参数
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user';
$db['default']['password'] = 'password';
$db['default']['database'] = 'dbname';这是你必须做的最基本的更改....
现在如果你想默认将它重定向到特定的控制器,请转到配置目录中的 routes.php 文件并更改此变量 $route['default_controller'] = "yourcontrollername"
回答by Gautam3164
At first config your site settings using config.phpand also for database settings edit the database.phpand then in file router.php file give the default controller name for your site
首先使用config.php配置您的站点设置,并为数据库设置编辑database.php,然后在文件 router.php 文件中为您的站点提供默认控制器名称
$route['default_controller'] = 'login';
that will help to open an controller on the first loading of the project like login page or homepage etc,and then open your website like
这将有助于在第一次加载项目(如登录页面或主页等)时打开控制器,然后打开您的网站,如
http://your_ip/project_folder_name/
then it will directly open your default controller page.I think it will help for you as well.these are the very basic things that can help you to run the project ,glad that you are working on CodeIgniter,this framework is very flexible and easy to learn,enjoy to work on this
然后它会直接打开你的默认控制器页面。我认为它也会对你有帮助。这些是可以帮助你运行项目的非常基本的东西,很高兴你正在使用 CodeIgniter,这个框架非常灵活和简单学习,享受工作
回答by Amaan Iqbal
Use localhost/name_of_the_codeigniter_folder_inside_htdocs/index.php/name_of_the_controller_file_you_want_to_execute/name_of_the_function_inside_the_file_which_you_want_to_execute
使用 localhost/name_of_the_codeigniter_folder_inside_htdocs/index.php/name_of_the_controller_file_you_want_to_execute/name_of_the_function_inside_the_file_which_you_want_to_execute
Hope this helps!
希望这可以帮助!