开发者

Codeigniter passing "Name/Name" as one parameter in a url

开发者 https://www.devze.com 2023-03-23 08:56 出处:网络
class Barcode extend开发者_开发百科s CI_Controller { function index($barcode, $text=\'\', $format=\"PNG\", $quality=100, $width=160, $height=80, $type=1)
class Barcode extend开发者_开发百科s CI_Controller 
{

    function index($barcode, $text='', $format="PNG", $quality=100, $width=160, $height=80, $type=1)

}

I have the following function and I want to pass the following in the URL:

http://localhost/index.php/barcode/index/1/Test%2FTest/PNG/100/256/80/1

But I get a 404 when trying to do this.


Don't you need to get all the parts of the GET request via $this->uri->segment('{n}') first?

I might be wrong, but I don't think the way you are doing it is right. If I was to code this I would do the following:

function index()  
{
    $barcode = $this->uri->segment('3');  
    $text    = $this->uri->segment('4');  
    $format  = $this->uri->segment('5');  
    $quality = $this->uri->segment('6');  
    $width   = $this->uri->segment('7');  
    $height  = $this->uri->segment('8');  
    $type    = $this->uri->segment('9');  

    // continue with your code  
}
0

精彩评论

暂无评论...
验证码 换一张
取 消