Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

225
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda