我正在尝试将一些数据发布到包含双引号的URL。我通过添加反斜杠来转义引号。我只是想澄清在发布数据时会出现问题。
$data = "{\"phoneNumber\":\"$no\",\"campid\":\"$refer\",\"simcards\":[{\"srno\":\"89914904040576482763\",\"mcc\":404,\"mnc\":49,\"operatorName\":\"airtel\",\"circleName\":\"AndhraPr\",\"msisdn\":\"\"},{\"srno\":\"89914904040874441867\",\"mcc\":404,\"mnc\":49,\"operatorName\":\"airtel\",\"circleName\":\"AndhraPr\",\"msisdn\":\"\"}]}";
如果我不使用反斜杠,可以选择什么。
答案 0 :(得分:0)
只是在外面使用单引号然后你不必逃避
中的双打 $data = '{"phoneNumber":"'.$no.'","campid":"'.$refer.'","simcards":[{"srno":"89914904040576482763","mcc":404,"mnc":49,"operatorName":"airtel","circleName":"AndhraPr","msisdn":""},{"srno":"89914904040874441867","mcc":404,"mnc":49,"operatorName":"airtel","circleName":"AndhraPr","msisdn":""}]}';