Das ist, weil Ihr JSON ungültig ist. Sie müssen es entkommen, wie so:
{
"cv_url": "http://localhost/kaj/wp-content/uploads/2017/03/Mir-Ruhul-Amin.doc",
"cv_path": "C:\\wamp\\www\\kaj/wp-content/uploads/2017/03/Mir-Ruhul-Amin.doc"
}
So Ihre Variable eigentlich sein sollte:
'{"cv_url": "http://localhost/kaj/wp-content/uploads/2017/03/Mir-Ruhul-Amin.doc","cv_path": "C:\\wamp\\www\\kaj/wp-content/uploads/2017/03/Mir-Ruhul-Amin.doc"}'
für PHP, sie zu entschlüsseln.
JSON entkommen Sie zuerst das Array in PHP einfach codieren kann, oder wenn, dass Sie nicht zusagt können Sie die folgende Funktion verwenden:
/**
* @param $value
* @return mixed
*/
function escapeJsonString($value) {
$escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
$replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b");
$result = str_replace($escapers, $replacements, $value);
return $result;
}
TIP:
Sie können die Gültigkeit prüfen immer von Ihre json auf Online-Tools wie:
http://jsonlint.com
und
http://www.jsoneditoronline.org/
Wie bekommen Sie dieses JSON? Sie kodieren es selbst oder erhalten es zum Beispiel über API? – hassan
Ich bekomme es von json_encode() -Funktion – ruhul080
Wie codierst du dein Array? – hassan