0
我编写了这个函数来在magento中创建新帐户,但是如果我编写阿拉伯文字,它会发送编码数据,并且数据会以编码的url发送,所以我想对其进行解码。它创建的编码数据的帐户这样在PHP中解码变量
%D9%85%D8%AD%D9%85%D8%AF %D8%B5%D8%A7%D8%A8%D8%B1
原话[ محمد صابر ]
function register($email , $password , $firstname , $lastname )
{
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($email);
if(!$customer->getId()) {
$customer->setEmail(utf8_decode($email));
$customer->setFirstname(utf8_decode($firstname));
$customer->setLastname(utf8_decode($lastname));
$customer->setPassword(utf8_decode($password));
try {
$customer->save();
$customer->setConfirmation(null);
$response["success"] = 1;
}
catch (Exception $ex) {
$response["success"] = 0;
}
}
else{
$response["success"] = 0;
}
header('Content-Type: application/json; charset=utf-8');
return json_encode($response);
}
变化形式方法'POST',最好为您发送不仅仅是小文本。 –