using a echo as property #60
-
|
I have a project where I want a message send by GET or POST propagat to my app. The reason is I want to show some sort of result. This is my index.php The problem is that this is rendered as For some obscure reason. If I leave out "" in on the How would I transmit a json object as app prop in PHP? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
@kingma-sbw You’re running into this because you’re calling json_encode() on a string, not on an actual JSON-object. A solution would be to check |
Beta Was this translation helpful? Give feedback.
@kingma-sbw You’re running into this because you’re calling json_encode() on a string, not on an actual JSON-object.
Since
$_GET['message']is emptyjson_encode("{}")is being called, which results in"\"{}\"".A solution would be to check
$_GET['message']first and depending on that encode it or return the JSON-Object: