Sometimes for security and user permissions, we do not directly download files from the web path over http to the client. now let's talk about how php implements file download principles and instances. 1. php download principle, file download source code :? Ph... sometimes for security and user permissions, we do not directly download files from the client using the web path. now let's talk about how php implements file download principles and instances.
1. php download schematic
2. file download source code:
3. Solution to file encoding problems:
If the file name is Chinese, php functions cannot recognize the Chinese file name. generally, if the program code is UTF-8, php functions are old and can only recognize the Chinese characters encoded in gb2312, therefore, the iconv ("original encoding", "encoding to be converted", and "string to be transcoded") function can be used for transcoding.
For example, transcode a string from UTF-8 to gb2312
$ File_name = iconv ("UTF-8", "gb2312", "$ file_name ");
How PHP downloads remote files
Get_img_file ('http: // news.sina.com.cn/c/2011-09-16/021323162600.shtml ');
Article address:
Reprint at will ^ please include the address of this article!