Shorten URL by removing empty GET variables and simplifying variable names

后端 未结 4 867
温柔的废话
温柔的废话 2021-01-25 18:19

I am working on a website where an URL is composed after submitting a GET form. The form values are passed as an array of variables of which at least one must b

4条回答
  •  长情又很酷
    2021-01-25 19:15

    The parameter names come from the form's fields' name attributes.

    So to make the form query for name=lorem+ipsum the input would have to look like this:

    You should look at the name attributes, I'm guessing they are generated by some code you are using to create the code? The empty query parameters come from other input fields in the form. If you want full control of the query string, create the form by hand.

提交回复
热议问题