简体   繁体   English

URL 中带有百分比的文件名

[英]Filename with percent in URL

I have a directory that contains several pdfs, I have a script that sets the path for access and everything else,我有一个包含多个 pdf 的目录,我有一个设置访问路径和其他所有内容的脚本,

<a href="<?= get_home_url().'/'.$certificate->file_path.'/'.$certificate->file_name ?>" target="_blank">Baixar</a>

however I am having a 404 error in files that contain accents of type (comma and percent),但是我在包含重音类型(逗号和百分比)的文件中出现 404 错误,

File with accent:带口音的文件:

http://exodocientifica.com.br//_fispq/ALARANJADO%20DE%20METILA%200,2%.pdf http://exodocientifica.com.br//_fispq/ALARANJADO%20DE%20METILA%200,2%.pdf

other files without accent are normally accessed,通常访问其他没有重音的文件,

File without accent: http://exodocientifica.com.br//_fispq/ALARANJADO%20DE%20METILA.pdf无重音文件: http : //exodocientifica.com.br//_fispq/ALARANJADO%20DE%20METILA.pdf

already I tried using functions like urlencode, htmlentities, hand did not get results我已经尝试使用 urlencode、htmlentities、hand 等函数没有得到结果

You should encode % with %25 since it is a special character in URL.您应该使用%25%进行编码,因为它是 URL 中的特殊字符。 Try using this URL instead:尝试改用此 URL:

http://exodocientifica.com.br//_fispq/ALARANJADO%20DE%20METILA%200,2%25.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM