获取函数输入字符串函数
Getting the file extension from a PHP string can be very important in validating a file or file upload. I've written a simple PHP function to retrieve a file extension from a string.
从PHP字符串获取文件扩展名对于验证文件或文件上传非常重要。 我编写了一个简单PHP函数,用于从字符串中检索文件扩展名。
代码 (The Code)
function get_file_extension($file_name) { return substr(strrchr($file_name,'.'),1);}
This simple method of file extension retrieval should be reused throughout your code.
这种简单的文件扩展名检索方法应在整个代码中重复使用。
翻译自:
获取函数输入字符串函数