用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1961|回复: 5
收起左侧

[已解决] 关于CI教程create页面插入数据库的问题

[复制链接]
发表于 2015-2-15 17:00:10 | 显示全部楼层 |阅读模式




为什么我点击Create news item URL会变成

http://test.com/index.php/news/test.com/index.php/news/create?然后显示404
发表于 2015-2-15 23:37:21 | 显示全部楼层
johngngn 发表于 2015-2-15 17:05
按正常应该他要运行else那部分,但是不知道为什么运行不了。
还有那个URL也很诡异。 ...

config 內的 base_url 請設為空
 楼主| 发表于 2015-2-15 17:01:32 | 显示全部楼层
public function create()
    {
        $this->load->helper('form');
        $this->load->library('form_validation');

        $data['title'] = 'Create a news item';

        $this->form_validation->set_rules('title', 'Title', 'required');
        $this->form_validation->set_rules('text', 'text', 'required');

        if ($this->form_validation->run() === FALSE)
        {
            $this->load->view('templates/header', $data);
            $this->load->view('news/create');
            $this->load->view('templates/footer');

        }
        else
        {
            $this->news_model->set_news();
            $this->load->view('news/success');
        }

    }

这段代码我都照抄的。
 楼主| 发表于 2015-2-15 17:05:22 | 显示全部楼层
按正常应该他要运行else那部分,但是不知道为什么运行不了。
还有那个URL也很诡异。
 楼主| 发表于 2015-2-16 10:01:24 | 显示全部楼层
Closer 发表于 2015-2-15 23:37
config 內的 base_url 請設為空

谢谢。已解决!
 楼主| 发表于 2015-2-16 10:01:28 | 显示全部楼层
Closer 发表于 2015-2-15 23:37
config 內的 base_url 請設為空

谢谢。已解决!

本版积分规则