Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

228
Visualizações
How to add newline in shell_exec php?

I want to execute a node.js file via php. The thing that I want to achieve in PHP is this

C:proj> node main.js text="This is some text.
>> some more text in next line"

My php script

shell_exec('node C:\proj\main.js text="This is some text. \n some more text in next line"');

But in my main.js file, I'm only getting

text = this is some text.

rest of the string is getting removed. Could anyone help please?

Things I've tried

  1. \n
  2. `n
  3. >>
  4. PHP_EOL
  5. ^
  6. ^\n

but no luck!

I hope my question is clear. Please feel free to ask for more details.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

shell_exec("node C:\proj\main.js text=\"This is some text.\n>> some more text in next line\"");

will equivalent of your console command

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda