Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想对帖子的标题进行编码,以便将其添加到我的 URL 中。问题是 urlencode() 给了我一个 URL,例如:
标题:
Samsung Nexus S + Hard Case
网址:
Samsung%20Nexus%20S%20+%20Hard%20Case
我想要一个更友好的,比如:
Samsung+Nexus+S+Hard+Case
我不知道“+”符号会发生什么。我怎样才能做到这一点?
将空格替换为+since%20是空格的 url 编码。下面是 PHP 中的空间替换示例:
+
%20
str_replace(' ', '+', $url_encoded_string);