Laravel  
laravel
文档
数据库
架构
入门
php技术
    
Laravelphp
laravel / php / java / vue / mysql / linux / python / javascript / html / css / c++ / c#

php url gbk

作者:空白篇pia~   发布日期:2026-01-10   浏览:146

To convert a URL to GBK encoding in PHP, you can use the urlencode() function along with the mb_convert_encoding() function. Here's an example:

$url = "https://example.com/你好";

$encodedUrl = urlencode($url);
$gbkUrl = mb_convert_encoding($encodedUrl, 'GBK', 'UTF-8');

echo $gbkUrl;

In this example, the URL "https://example.com/你好" is first encoded using urlencode(), which replaces non-ASCII characters with percent-encoded values. Then, the mb_convert_encoding() function is used to convert the encoded URL from UTF-8 to GBK encoding.

Note that the mb_convert_encoding() function requires the mbstring extension to be enabled in PHP.

上一篇:php 入栈abcde

下一篇:php 设置访问超时

大家都在看

php session用法

php 定义常量

phpisset函数

php html转图片

php后端

php爬虫框架

php读取csv文件

php+mysql动态网站开发

phpmyadmin docker

php session id

Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3

Laravel 中文站