search

Home  >  Q&A  >  body text

php - Issues related to url parameter transmission. There is a # sign in the parameter. Please come in quickly.

There is a query function in the website
Query the content containing keyword parameters in the title of the article
I am currently encountering a rather embarrassing title
I want to check if there is any one that contains c# Article
url: article?keyword=c#
As you can imagine, when it is received by the server, it becomes keyword=c
How to solve this kind of problem?
Currently, it is not possible to modify URLs one by one across the entire site for escaping. Is there any way to perform actions in the existing <a> tags?

PHP中文网PHP中文网2800 days ago718

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-05-16 13:09:34

    Use urlencode() 进行url编码转换,类似可以把 # 转化为 %23 , there is no need to submit it specifically for posts, Baidu also handles it this way

    reply
    0
  • 怪我咯

    怪我咯2017-05-16 13:09:34

    It is a special character. The browser automatically truncates the # character and the value after it. You can transcode it before passing it, or submit it via post

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 13:09:34

    encodeURIComponent()

    reply
    0
  • 为情所困

    为情所困2017-05-16 13:09:34

    Or transcode or directly change to characters recognized by other browsers.

    reply
    0
  • Cancelreply