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

225
Visualizações
How to display text from a file

I have a text file on my server, which I would like to display in a Label (or similar element). What is the best way to do this? If possible, I would like it to be formatted the same way as it is in the text file.

(I was thinking it would be similar to using "src" for images, but turns out you can't do that).

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I would try reading the file with PHP, process the text (split in parts, cut, whatever) and set up an array with the required texts.You can call it later with using the array.

Finally ur code should look something like this:

<img src="<?=$arrayText['test1]?>" class=".." alt="...">

More information

PHP read .txt files: https://www.w3schools.com/php/php_file_open.asp

Several functions for processing strings: https://www.php.net/manual/de/ref.strings.php

Several functions for using arrays in PHP: https://www.php.net/manual/de/ref.array.php

about 4 years ago · Juan Pablo Isaza Relatório

0

You will need to have a local web server (NodeJS, Python, etc.) to serve your local assets and then either render the HTML file dynamically (eg: via Express for NodeJS) or make a fetch request (eg: fetch('/path/to/file.txt'))

about 4 years ago · Juan Pablo Isaza 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