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

172
Vistas
How to access using php a json file located in the src folder in ReactJS

How to access using php a json file located in the src folder in ReactJS

my data.json file in my Project

After building I can't access to the data.json file

The files look like this build folder

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Generally speaking, you don't. The src folder contains the source code for the React app. It isn't something that should be directly used in production.

If you are using Webpack to build your production version then, as per this answer you can use the CopyWebpackPlugin plugin to copy the JSON file to your build directory and deploy it with the rest of the application.

That should give you a predictable file path (if the PHP is on the same system as the server for the React frontend) or URL (otherwise) that you can request with file_get_contents and then parse with json_decode.

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