php传递post参数出现乱码怎么解决?
php传递post参数出现乱码怎么解决?下面编程教程网小编给大家详细介绍一下具体代码!
实现代码如下:
public function add(){
$user = session("user_name");
if(session("user_name")){
//修改
header("Content-Type:text/html;charset=utf8");
//为
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
request.setCharacterEncoding("UTF-8");
$common = D("Common");
$data["user_id"] = $user[0]["user_id"];
$data["user_name"] = $user[0]["user_name"];
$data["pro_id"] = $_POST["pro_id"];
$data["pro_name"] = $_POST["pro_name"];
$data["pro_price"] = $_POST["pro_price"];
$data["pro_num"] = $_POST["pro_num"];
$data["pro_total"] = $_POST["pro_num"]*$_POST["pro_price"];
dump($data);
echo $data["pro_name"];
}
}
以上是编程学习网小编为您介绍的“php传递post参数出现乱码怎么解决?”的全面内容,想了解更多关于 php入门 内容,请继续关注编程基础学习网。