Answer the question
In order to leave comments, you need to log in
json_encode() How to pass back quotes?
Good day guys. Please tell me, I have an array in php, the array has a "txt" key with a large text value, which should go through json to js. But as you know, if the text is large and it has a new line, then js needs back quotes. And php doesn't want to display text in back quotes. How do I pass correctly from php to js array?
Thank you.
Answer the question
In order to leave comments, you need to log in
But as you know, if the text is large and it has a new line, then js needs back quotes. And php doesn't want to display text in back quotes.
const variable = JSON.parse('<?= json_encode(['...']) ?>');
const variable = '...']) ; = json_encode([
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question