简体   繁体   English

如何在Codeigniter中从URL隐藏获取参数

[英]How to hide get parameter from url in codeigniter

I want to hide get parameter from url. 我想从网址隐藏获取参数。

I have URL like domain.com/controller/function?clear=1 我有类似domain.com/controller/function?clear=1的 URL

I want to remove ?clear=1 from URl and want to URL like: domain.com/controller/function 我想从URl中删除?clear = 1,并希望使用类似URL的域名domain.com/controller/function

it is possible in codeigniter but how ? 有可能在codeigniter中,但是如何呢? i saw some similar question here but i can't found proper solution. 我在这里看到了类似的问题,但找不到合适的解决方案。

This is not possible to hide the get parameter. 隐藏get参数是不可能的。 You can use ajax to send the parameter like this 您可以使用ajax这样发送参数

        var id = "your parameter which you want to send in the url";
        $.ajax({
            url:"<?php echo site_url('controller/function');?>/"+id,
            success:function(data)
            {



            }

            });
        }

Try this for more link 试试这个以获得更多链接

You can use base64_encode before send data and when you catch that in Controller base64_decode 您可以在发送数据之前以及在Controller base64_decode捕获数据时使用base64_encode

Examples of Encoding & Decoding Encrypted PHP 加密PHP的编码和解码示例

In View 视野中

<a href="<?php echo base_url()?>Controller_name/Method/<?php base64_encode('Im the value')?>"

In Controller 在控制器中

public function Method($id)
{
   $valid_id = base64_decode($id);
}

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

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