Controller 功能 public function test(){ ech-6ren">
gpt4 book ai didi

php - 表单操作 url 在 codeigniter 中不起作用

转载 作者:可可西里 更新时间:2023-11-01 00:55:57 24 4
gpt4 key购买 nike

我正在尝试在表单操作中使用 url,而不是在 codeigniter 中使用表单助手,但它不起作用。

<form method="post"  action="<?php echo base_url().'test'; ?>">
<form method="post" action="/main_controller/test">

Controller 功能

public function test(){
echo "test function";
}

我得到的错误

http://prntscr.com/eyzhdd

最佳答案

应该是

<form method="post"  action="<?php echo base_url()?>index.php/main_controller/test">

base_url() 也应该定义为(application/config/config.php)

https://stackoverflow.com/
^ on the end

$config['base_url'] = 'https://stackoverflow.com/'; # Line 26 if version 3.0+

<?php echo base_url()?>index.php/main_controller/test
^ ^ ^ ^
base URL index Controller Name Method name

查看 Codeigniter documentation .

关于php - 表单操作 url 在 codeigniter 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43534246/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com