问题:
Win32 下Apache2 用get 方法传递中文参数会出错,如test.php?a=你好&b=你也好,传递参数导致一个内部错误。
解答:
使用urlencode()函数进行转换,如"test.php?a=".urlencode(你好)."&b=".urlencode(你也好)
详细介绍:
urlencode()函数主要是用于返回字符串类型,该函数会将传入的字符串进行编码urlencode()函数与rawencode()函数不同的是,urlencode()函数会将“空格”转换成“+”;而rawencode()函数则会将“空格”转换成“%20”。urlencode()函数的其他字符串转换方式与rawencode()函数的字符串转换方式相同。
urlencode()函数的语法如下:
string urlencode (string str)
更多问题请访问PHP中文网:PHP视频教程
以上就是WIN32下,Apache2用get方法传递中文参数报错的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号