【发布时间】:2012-07-06 14:25:56
【问题描述】:
我正在使用 hmvc 创建一个注册页面:-
现在我在网址中输入:- http://localhost/CI/index.php/user/registration
user 是模块名
控制器:-registration.php
<?php
class Registration extends MX_Controller{
function index() {
$this->load->view('homepage');
}
function register(){
$this->load->view('registrationPage');
}
}
?>
查看:-homepage.php
<html>
<body>
<a href="registration/register">register</a>
</body>
</html>
问题是在我的网址中我必须输入http://localhost/CI/index.php/user/registration/register 才能进入注册页面。
我想要http://localhost/CI/index.php/user/register,我们该怎么做。?
设置 base_url 不起作用,设置路由 ia 也不起作用。
这是否可以转到任何页面而不在 url 中提供模块名称..?
【问题讨论】:
-
只需将您的
anchor tag更改为 注册 :-) -
no buddy.. :( 找不到它的说页面.....
-
你能告诉我当你得到
page not found时url显示的是什么 -
显示
http://localhost/CI/index.php/register -
对不起,我误解了你的问题。现在我的建议是您可以在 PHP 的
.htaccess文件中进行 URL 重定向。
标签: php codeigniter codeigniter-url