Php Codeigniter-为什么我必须在html表单操作中指定应用程序文件夹名称?

Php Codeigniter-为什么我必须在html表单操作中指定应用程序文件夹名称?,php,forms,codeigniter,action,href,Php,Forms,Codeigniter,Action,Href,可以避免在html表单操作中指定应用程序名称吗? 抱歉,如果此问题重复。请在config.php中设置基本url echo form_open('index/function'); 然后像下面那样使用它 $config['base_url'] = 'http://localhost/codeigniter/'; 在config.php中设置基本url echo form_open('index/function'); 然后像下面那样使用它 $config['base_url'] = 'ht

可以避免在html表单操作中指定应用程序名称吗?
抱歉,如果此问题重复。

请在config.php中设置基本url

echo form_open('index/function');
然后像下面那样使用它

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

在config.php中设置基本url

echo form_open('index/function');
然后像下面那样使用它

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

Use
site\u url('index/search')
Use
site\u url('index/search')
hey感谢您的回复。我想知道如果其他人使用它,指定它是否会导致问题。例如,我认识的人直接使用localhost来运行应用程序,而不是指定localhost/codeigniter。站点url是更好的选择吗?您可以将其留空,让CI在运行时猜测它。我通常都是这样做的,在Linux和Windows上从来没有遇到过问题Servers@shn是的,您可以使用
站点url(“索引/搜索”)
Ya我决定使用site\u url,因为它更快,而且不需要我更改配置。谢谢你的帮助。嘿,谢谢你的回复。我想知道如果其他人使用它,指定它是否会导致问题。例如,我认识的人直接使用localhost来运行应用程序,而不是指定localhost/codeigniter。站点url是更好的选择吗?您可以将其留空,让CI在运行时猜测它。我通常都是这样做的,在Linux和Windows上从来没有遇到过问题Servers@shn是的,您可以使用
站点url(“索引/搜索”)
Ya我决定使用site\u url,因为它更快,而且不需要我更改配置。谢谢你的帮助。
<form id="search" action="<?php echo $this->config->base_url(); ?>index/search" method="post">