我想逃避&符号。因为,它假设另一个参数..我想将以下所有这些消息传递给java web服务参数..那个符号符号剪切了消息..请任何人帮忙
我的PHP代码:
$message ="Hi $names \r\n";
$message.="Welcome to Home 2 Office Rider Network. To activate your account \r\n";
$message.="please verify your email using below URL \r\n\n";
$message.="http://localhost/h2orn/php/verify.php?email=$emails&hash=$hash \n\n\n ";
$message.="Thanks for your interest and support to H2ORN. Kindly reach out to \r\n";
$message.="'care@h2orn.in' for any queries relating to H2ORN operations.\r\n\n\n";
$message.="Thanks\r\n";
$message.="Support Team\r\n\n\n";
$message.="This is automated email message. Please do not reply to this email.\r\n \n\n";
$url = "http://localhost:8084/mail/webresources/EmailTest";
$mail = "toAddress=" . $emails . "&emailbody=" . $message ;
$ch = curl_init($url);
感谢您提前,
答案 0 :(得分:2)
你只是想要对&符号进行编码,你想对所有的值进行正确的URI编码。您可以使用urlencode
function。
$mail = "toAddress=" . urlencode($emails) . "&emailbody=" . urlencode($message) ;
// ^^^^^^^^^ ^^^^^^^^^