Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.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中的url中_Php_Get - Fatal编程技术网

如何传递带有字符'的字符串&';在php中的url中

如何传递带有字符'的字符串&';在php中的url中,php,get,Php,Get,我正在用PHP开发程序。现在,我想使用$\u GET传递带有“&”字符的整个字符串。但是我遇到了一些问题,比如它从字符“&”中删除了字符串 我使用的代码如下 $customer="Mahindra & Mahindra PVT.LTD." <a href="main.php?cust=". $customer."">Procceed</a> 它的输出是“Hahindra”,但我想得到整个字符串。 <?php $customer="Mahindra &

我正在用
PHP
开发程序。现在,我想使用
$\u GET
传递带有“&”字符的整个字符串。但是我遇到了一些问题,比如它从字符“&”中删除了字符串 我使用的代码如下

$customer="Mahindra & Mahindra PVT.LTD."
<a href="main.php?cust=". $customer."">Procceed</a>
它的输出是“
Hahindra
”,但我想得到整个字符串。


<?php $customer="Mahindra & Mahindra PVT.LTD.";
echo '<a href="main.php?cust="'.urlencode($customer).'">Procceed</a>'; ?>


urlencode函数可能会帮助您urlencode函数可能会帮助您
<?php $customer="Mahindra & Mahindra PVT.LTD.";
echo '<a href="main.php?cust="'.urlencode($customer).'">Procceed</a>'; ?>