English 中文(简体)
编码困难
原标题:codeigniter 2.1.0 Routing difficulties

我不能把控制器装上控制器。

http://localhost/index.php?controller/method

But if i does not use ? and try to load a controller from view then duplicate URL produce. As an example of above, if i add this link in form action in view then result url will be

http://localhost/index.php/controller/index.php/controller/method

How to solve it? I did not use htaccess file

问题回答

使用<代码>site_url()功能,或如JohnFable所述,使用f或m_ open功能。

<f或m method="post" action="<?= f或m_open( controller/method ); ?>">

<a href="<?= site_url( controller/method ); ?>">Controller/Method</a>

<?= f或m_open( controller/method ); ?>

This will ensure that your "base url", i.e. http://localhost is prepended c或rectly to the URL you want to view, i.e. http://localhost/index.php/controller/method 或 if you have set it up to, http://localhost/controller/method

Gavin





相关问题
Git environment for CodeIgniter project

I m starting of with a new CI project based on the CI 2.0 Reactor repository. Because the CI2 code is still changing, I would like to keep that code fresh, the question is how (using Git). For the ...

codeigniter modular extensions

I m trying to implement modular extensions into a codeigniter 2 setup but am having a few problems. I followed the installation instructions on the wiki and everything was working fine. Then I started ...

How to create a Codeigniter non page refreshing signup form?

Heres what I m trying to do. I want to have a homepage with my signup form that doesn t refresh the page every time a validation step is failed. I want my signup form to have 2 steps. 1st step ...

CodeIgniter: How to get Controller, Action, URL information

I have these URLs: http://backend.domain.com/system/setting/edit/12 http://backend.domain.com/product/edit/1 How to get controller name, action name from these URLs. I m CodeIgniter newbie. Are ...

热门标签