Home >Backend Development >PHP Tutorial >php basename 获取文件名,特殊符号的话会有乱码!

php basename 获取文件名,特殊符号的话会有乱码!

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:11:261802browse

<code>$url="http://down.99i.Cc:54109/www.xubo.cc/天堂口/【久久爱影院www.xubo.cc】天堂口HD国语中字1024x576版.rmvb";
$name=basename($url);
//输出的结果如下:
string '��久久爱影院www.xubo.cc】天堂口HD国语中字1024x576版.rmvb' (length=70)</code>

有乱码出现应该怎么解?

回复内容:

<code>$url="http://down.99i.Cc:54109/www.xubo.cc/天堂口/【久久爱影院www.xubo.cc】天堂口HD国语中字1024x576版.rmvb";
$name=basename($url);
//输出的结果如下:
string '��久久爱影院www.xubo.cc】天堂口HD国语中字1024x576版.rmvb' (length=70)</code>

有乱码出现应该怎么解?

设置编码 utf-8看看

<code>header("Content-type: text/html; charset=utf-8");</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn