Skip to content

Instantly share code, notes, and snippets.

@WenLiangTseng
Created October 27, 2013 07:45
Show Gist options
  • Save WenLiangTseng/7178911 to your computer and use it in GitHub Desktop.
Save WenLiangTseng/7178911 to your computer and use it in GitHub Desktop.
解決檔案上傳時,PHP的basename函數不支援中文的方法
<?php
//php自帶的basename函數不支持中文,下面這個方法是最簡單的實現。
function get_basename($filename){
return preg_replace('/^.+[\\\\\\/]/', '', $filename);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment