简体   繁体   English

网址重复codeigniter和杂货杂货

[英]url repeating codeigniter and grocery crud

I have a controller Admin and under Admin it has it has a function called Password . 我有一个控制器Admin ,在Admin下它具有一个称为Password的功能。 Password is a function created with grocery crud. 密码是使用杂货杂货创建的功能。 Everything works fine except for the URL generated after the edit action in the grocery crud part. 一切正常,除了在杂货杂货部分中执行编辑操作后生成的URL。

Before integration of grocery crud, I have no problems with regards to URL like switching on mod_rewrite and base_url(). 在整合杂货杂货之前,我对URL没问题,例如打开mod_rewrite和base_url()。

http://localhost/site/admin/home
http://localhost/site/admin/password
http://localhost/site/admin/report

During editing action in the password function I got this URL (This is the grocery crud URL): 在使用password功能进行编辑操作期间,我得到了以下URL(这是杂货杂货URL):

http://localhost/site/admin/password/edit/1

After update or success URL part is: 更新或成功后,URL部分为:

http://localhost/site/admin/password/success/1

This is where my problem starts. 这是我的问题开始的地方。 When I want to go to admin/home and admin/report from the after update or success URL the result is: 当我想从更新后或成功的URL转到admin/homeadmin/report ,结果是:

http://localhost/site/admin/password/admin/home
http://localhost/site/admin/password/admin/report

Any help will do. 任何帮助都可以。

If you are using the site_url() function, then you can simply have <?php echo site_url('admin/home'); ?> 如果您正在使用site_url()函数,则可以简单地使用<?php echo site_url('admin/home'); ?> <?php echo site_url('admin/home'); ?> and <?php echo site_url('admin/report'); ?> <?php echo site_url('admin/home'); ?><?php echo site_url('admin/report'); ?> <?php echo site_url('admin/report'); ?> to route properly. <?php echo site_url('admin/report'); ?>正确路由。

<?php echo site_url('admin/home'); ?> <?php echo site_url('admin/home'); ?> will give you http://localhost/site/index.php/admin/home depending on your site configuration. <?php echo site_url('admin/home'); ?>会根据您的站点配置为您提供http://localhost/site/index.php/admin/home If you use base_url() instead of site_url() , the index.php segment from the URL will be removed. 如果使用base_url()代替site_url() ,则将从URL中删除index.php段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM