Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP如何向空间添加数据_Php - Fatal编程技术网

PHP如何向空间添加数据

PHP如何向空间添加数据,php,Php,我需要从名为$destination的变量中获取数据,并在信息之间添加空格 例如: echo $destination; 将返回:123 Main St 但我需要它返回123%20Main%20St 因此,我需要一个脚本,它将从$destination获取数据,并在空格中添加%20。使用urlencode()生成特殊字符编码百分比的字符串 echo urlencode($destination); 使用urlencode()生成特殊字符编码百分比的字符串 echo urlencode($de

我需要从名为
$destination
的变量中获取数据,并在信息之间添加空格

例如:

echo $destination;
将返回:
123 Main St
但我需要它返回
123%20Main%20St

因此,我需要一个脚本,它将从
$destination
获取数据,并在空格中添加
%20

使用
urlencode()
生成特殊字符编码百分比的字符串

echo urlencode($destination);
使用
urlencode()
生成特殊字符编码百分比的字符串

echo urlencode($destination);

你好,到目前为止你试过什么?这能回答你的问题吗?你好,到目前为止你试过什么?这能回答你的问题吗?