search

Home  >  Q&A  >  body text

The file path has been saved in the database table. How can I output the file name from the database on the page and click on the file name to view the file content?

I am doing a file upload and output. Now the file upload has been implemented, but I don’t know how to output the output. The path of the file has been reserved in the database. I want to output the file name on the page, and then click on the file name to view the entire content of the file. How to achieve this?

生如夏花生如夏花2070 days ago1291

reply all(3)I'll reply

  • 刘某

    刘某2019-04-24 16:09:58

    Garbled characters are generally caused by encoding problems. You must first determine the encoding of the file you read, and then convert it

    $str = file_get_contents("./1.txt");
    $encod = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
    $str = iconv($encod ,'UTF-8' ,$str);
    echo $str;


    reply
    0
  • 刘某

    刘某2019-04-24 11:56:22

    file_get_contents(filename)

    试试

    reply
    0
  • 生如夏花

    When file_get_contents(filename) is opened, garbled characters appear. How to solve it?

    生如夏花 · 2019-04-24 15:30:50
  • Cancelreply