urlencode在PHP(localhost)中不起作用 [英] urlencode doesn't work in PHP (localhost)

查看:262
本文介绍了urlencode在PHP(localhost)中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我从事的项目需要编码我的URL ,例如在我的URL中,我有:

So i worked in a project that i need to encode my URL, for example in my URL i have :

$url = 'http://www.test.com/?sms=+212&text=bla bla'
urlencode($url);

$url = urlencode($url);

我也尝试了rawurlencode($url);,我得到了相同的 URL ,没有任何变化!

Also i tried rawurlencode($url); and i got the same Url without changes !!

所以,如果有人有任何想法,我会非常感激:)

so please if someone has any idea i will be so appreciative :)

推荐答案

urlencode返回一个新的编码URL,不更改传递给它的$ url.试试这个

urlencode returns a new encoded url, doesn't change the $url passing to it. try this

$encoded_url = urlencode($url);

$ encoded_url是您想要的

$encoded_url is what you want

这篇关于urlencode在PHP(localhost)中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆