2016-08-02 81 views
0

我有接触外部API不添加斜线

$arr = array(
     "domain_name" => $_POST["domain"], 
     "auto_renew" => false, 
     "domain_lock" => false, 
     "whois_privacy" => false, 
     "contact_registrant_id" => $_POST["registrant_contact"], 
     "contact_admin_id" => $_POST["admin_contact"], 
     "contact_tech_id" => $_POST["tech_contact"], 
     "contact_billing_id" => $_POST["billing_contact"], 
     "auth_code" =>($_POST["auth_code"]) 
    ); 

我张贴的$_POST["auth_code"]值是l&"IkM%Wbjjq7

然而,当它张贴此值,它被张贴了这个PHP代码PHP后值as l&\\\"IkM%Wbjjq7

因此,它添加斜线,这是造成问题。

+0

你试过addslashes()吗? –

+0

为什么我'addslashes'当我不要他们 – charlie

+0

检查此链接http://stackoverflow.com/questions/6339145/how-to-remove-multiple-slashes-in-uri-with-preg-or-htaccess –

回答

1

它可以帮助你。 “magic_quotes_gpc”可能已启用。您可以在php.ini中禁用它。

magic_quotes_gpc = Off 

OR 

$str = $_POST["auth_code"]; 
echo get_magic_quotes_gpc() ? stripslashes($str) : $str; 

OR 

echo stripslashes($str); 
+0

目前禁用 – charlie