How to support Chinese path access in window version of PHP

小云云
Release: 2023-03-20 19:44:01
Original
4031 people have browsed it

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


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

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

相关推荐:
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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!