Answer the question
In order to leave comments, you need to log in
How to pass multiline argument in node.js?
<?php
$var = "Hello
World";
exec('node ../app/node/script.js ' . $var, $output);
echo $output; // Выводит 'Hello'
?>
console.log(process.argv[2])
Answer the question
In order to leave comments, you need to log in
Instead of double quotes, use reverse single quotes - located on the keyboard where the letter Y is
. As a bonus, the interpretation of variables in the string
let myVar = "строка";
const stroka = `Hello
${myVar}
World`;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question