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

176
Visualizações
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 Respostas
Responde à pergunta

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 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