简体   繁体   中英

Handling complex GET parameters with Slim Framework HTTP routing

Assuming the following naive code:

$app->get( '(/store(/:url)+)', function( $url = NULL ) use ( $app ) 
    {
        // Execute actions on $url
    });

The above works fine for the following:

http://localhost/api/0001/store/url-data

But it fails for:

http://localhost/api/0001/store/http%3A%2F%2Fexample.com%2FSomething
http://localhost/api/0001/store/http://example.com/Something

// and other variations

I wish to pass a full encoded URI to handle on the server side. How can I manage to do that with Slim?

Notes:

Other types of HTTP Requests (POST, PUT) won't work for this given problem.

It can be solved on the other end by reformatting (serializing) the URI, but I wish this to be my last resort.

Important Edit - Answer

So it turns out the above is a bug in the framework which is currently being tested and hopefully fixed and released soon. I solved the problem temporarily by serializing the URI before it reaches the server side.

So it turns out the above is a bug in the framework which is currently being tested and hopefully fixed and released soon. I solved the problem temporarily by serializing the URI before it reaches the server side.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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