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',最好爲您發送不僅僅是小文本。 –