Php 表单操作URL错误
我有一张这样的表格:Php 表单操作URL错误,php,codeigniter,Php,Codeigniter,我有一张这样的表格: <?php echo form_open('/student/insert',array('name' => 'myform'); ?> // form data like label, input tags // submit button <?php echo form_close(); ?> 现在,当我提交此表单时,URL变为: http://localhost://mycodeigniterproject/inde
<?php
echo form_open('/student/insert',array('name' => 'myform');
?>
// form data like label, input tags
// submit button
<?php
echo form_close();
?>
现在,当我提交此表单时,URL变为:
http://localhost://mycodeigniterproject/index.php/mycodeigniter/controllers/index.php/student/insert
然而,我认为应该是:
http://localhost/mycodeigniterproject/index.php/student/insert
我的代码有什么问题?为什么CodeIgniter不使用相对路径?将表单从
echo form_open('/student/insert',array('name=>'myform');
到
这应该能奏效
编辑:
看一看。您将看到一个表单帮助器工作原理的示例 它不再起作用了。现在url变为app/config/config.php中的
基本url是什么?应该是这样的:$config['base\u url']='http://localhost/mycodeigniterproject/';代码>
echo form_open('student/insert',array('name'=>'myform');