jq的get传参数在utf-8中乱码问题的解决php版

yipeiwu_com6年前PHP代码库
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
document.write(escape("哈哈")+"<br>");
document.write(unescape("%u54C8%u54C8")+"<br>");
document.write(encodeURIComponent("哈哈")+"<br>");
document.write(decodeURIComponent("%E5%93%88%E5%93%88")+"<br>");

</script>
</head>

<body>
<?php
echo urldecode("%E5%93%88%E5%93%88");
echo "<br>";
echo rawurldecode("%E5%93%88%E5%93%88");
echo "<br />";
echo utf8_decode("%E5%93%88%E5%93%88");
echo "<br />";
echo "%E5%93%88%E5%93%88";
echo "<br />";
echo $_GET['act'];
echo "<br />";
echo urlencode($_GET['act']);
?>
</body>
</html>

相关文章

PHP用反撇号执行外部命令

例如: echo `whoami`; // 导出数据库,要导入的文件夹必须要有可写权限, -u -p之后的内容必须要紧挨着写 复制代码 代码如下:echo `mysqldump -h l...

PHP UTF8编码内的繁简转换类

曾找过一个JS版的,但是到了UTF8编码里不能用,于是就产生了自已写一个的念头。其实我这个代码的实现原理很简单的,只是一个替换字符集的过程,相信大部份人都可以写得出来。以下是代码,不知道...

ThinkPHP 404页面的设置方法

在很多网站中都会有使用404页面的时候,在ThinkPHP框架中该如何设置呢,接下来我介绍其中一种方法 1、首先要在Lib/Action 下建立EmptyAction.class.php...

php变量与数组相互转换的方法(extract与compact)

本文实例讲述了php变量与数组相互转换的方法。分享给大家供大家参考,具体如下: 在php中数组与变量相互转换我们可使用到extract或compact函数,这里就来给大家分析一下这两个函...

php遍历目录方法小结

本文实例总结了php遍历目录方法。分享给大家供大家参考。具体如下: 1. 方法1     <?php function...