Home  >  Article  >  Backend Development  >  How to support Chinese path access in window version of PHP

How to support Chinese path access in window version of PHP

小云云
小云云Original
2018-03-06 10:48:384120browse

 本文主要和大家分享window版PHP支持中文路径访问的方法,让浏览器通过中文路径访问到php文件,如下图


需要设置url重写,和在index.php文件使用iconv函数

require_once iconv("utf-8","gbk",$_GET["url"]);
目录结构如下
在.htaccess文件配置
<IfModule mod_rewrite.c>  
Options +FollowSymlinks -Multiviews  RewriteEngine On  #RewriteCond %{REQUEST_FILENAME} !-d  #RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*(php)+.*)$ index.php?url=$1 [QSA,PT,L]
</IfModule>
这样就可以咯

相关推荐:
PHP的函数没法获得中文路径中的目录部分及文件名部分

php中的dirname等函数无法处理中文路径

中文路径导致unitpngfix.js不正常的解决方法_基础知识

The above is the detailed content of How to support Chinese path access in window version of PHP. For more information, please follow other related articles on the PHP Chinese website!

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