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?
刘某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;