如何传递带有字符'的字符串&';在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>'; ?>