开发者

In many applications I get & instead of & in the URL, therefore certain links don't work?

开发者 https://www.devze.com 2023-03-14 08:56 出处:网络
When I click the link I get an URL: like this: adipiscing-elit.&Sort=popular Is I change it to this:

When I click the link I get an URL: like this:

adipiscing-elit.&Sort=popular

Is I change it to this:

adipiscing-elit.&;Sort=popular
开发者_如何学编程

It works.

Is this a browser or php problem? Is it because I'm working in locahost?

(right now, I'm using a forum software called Vanilla)


URLs in a HTML link should contain & rather than a bare &. But in your case it's certainly a double-escaped & in the generated page. Somewhere in your used software the url is escaped twice with htmlentities or htmlspecialchars. Find all occourences and set the fourth function parameter $double_encode = false.

Another workaround would be to change the php.ini setting arg_separator.input = ";&"
This will allow & to function as separator by accident ("amp" will become an empty element, because the URL is broken up at & and ; then). But do that only if you cannot find the bug.


Not sure what your question is. The common delimiter of URI parameters is the ampersand '&', while '&' is the HTML / XML entity for the same character, the ampersand '&'. If you have an URI like so ;

adipiscing-elit.&Sort=popular

This translates roughly into parameters ;

 adipiscing-elit = (blank)
 amp;Sort = 'popular'

This is why your URI don't work; the 'amp;Sort' is the parameter name where you need it to be just 'Sort'.

0

精彩评论

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