【问题标题】:PhpStorm server using codeigniter使用 codeigniter 的 PhpStorm 服务器
【发布时间】:2015-12-14 11:41:25
【问题描述】:

在使用 IDE PhpStorm Codeigniter 开发项目时,如果我不生成服务器不会向我发送控制器的 url 以使用调试端口,如果我认为它也给了我一个服务器来访问失败。我不知道哪个是最佳设置。

http://localhost:63342/U5AP1E2Alex/index.php (U5AP1E2Alex是项目的文件夹)没关系

http://localhost:63342/U5AP1E2Alex/index.php/tienda/index (Tienda 控制器中的函数索引) KO - 404 Not Found

如果我构建一个部署服务器,我也会遇到问题。有什么更好的配置??

【问题讨论】:

  • 使用适当的 Apache/nginx/etc 网络服务器,而不是 PhpStrom 自己的简单内置网络服务器(您现在正在使用)。

标签: codeigniter phpstorm


【解决方案1】:

CodeIgniter 3v + 常见检查 404 错误。

http://www.codeigniter.com/docs

1:检查文件名是否首字母大写:

Tienda.php

2:检查类名的首字母是否大写:

<?php

class Tienda extends CI_Controller {
    public function index() {

    }
}

确保您的配置基本 url 不为空

$config['base_url'] = 'http://localhost:63342/U5AP1E2Alex/';

如果你的 url http://localhost:63342/U5AP1E2Alex/index.php/tienda/ index 那么应该直接指向索引函数,不需要在 url 末尾有函数索引

你可能需要配置一些路由http://www.codeigniter.com/user_guide/general/routing.html

$route['tienda'] = 'tienda/index';

或者如果在子文件夹中,即控制器 > some_folder > Tienda.php

$route['tienda'] = 'some_folder/tienda/index';

更新:

如果您在 url 中不需要 index.php,那么我建议您将其设为空白,如下所示。

$config['index_page'] = '';

并在您的主目录中添加一个 htaccess 文件。 Some htaccess Examples

【讨论】:

  • 谢谢,我设法按照您的指示工作。现在唯一的失败是,如果我尝试通过 localhost / index.php (或直接通过 PhpStorm 的链接browser)访问 index.php,我所指的地址是 localhost / xampp。
  • @JulenMLejarza 如果您不想在 url 中使用 index.php,我已经更新了问题。如果帮助充分,也不要投票或接受答案。
猜你喜欢
  • 1970-01-01
  • 2013-10-09
  • 1970-01-01
  • 2015-07-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多