Home >Backend Development >PHP Tutorial >Share the function of parsing url with Chinese characters in php_PHP tutorial
This article mainly introduces the sharing of the url function that parses Chinese characters in php. This article directly gives the implementation code, key points It is about the use of rawurlencode function. Friends who need it can refer to it
Many times, when writing web applications, you will encounter the problem of conflict between Chinese and other characters. For example, some URL links contain Chinese characters, so when you use wget/curl/file_get_contents, etc. to obtain information, you will directly conflict. A big "404" will be very speechless.
A small function is written here to solve this problem. It is only limited to parsing in the path. You can check the manual for the related functions involved.
The code is as follows: