使用 codeigniter 的 PhpStorm 服务器

PhpStorm server using codeigniter

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

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

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

如果我构建一个 Deployment Server,我也会遇到问题。什么是更好的配置??

CodeIgniter 3v + Common 检查 404 错误。

http://www.codeigniter.com/docs

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

Tienda.php

2: 检查 class 名字首字母大写:

<?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 那么应该直接进入索引函数不需要在 [=54= 末尾有函数索引]

您可能需要配置一些路由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