发现一个问题,使用get开源获取信息,并且开源展示出来,但是使用post信息开源获取,但是却展示不出来?
一:可以展示
视图
//显示查看详情信息
$(".shop_detail").click(function(){
var id = $(this).attr("tag");
$.get("/index.php/Admin/Providerapply/providers",{id:id},
function(data){
var obj = jQuery.parseJSON(data);
$("#product_pa_companyname").html(obj.pa_companyname);
// $("#product_pa_logoimg").html(obj.pa_logoimg);
$("#product_pa_companyabb").html(obj.pa_companyabb);
$("#product_pa_companysynopsis").html(obj.pa_companysynopsis);
$("#product_pa_business").html(obj.pa_business);
// $("#product_pa_companylicense").html(obj.pa_companylicense);
$("#product_pa_companynetwork").html(obj.pa_companynetwork);
$("#product_pa_name").html(obj.pa_name);
$("#product_pa_tel").html(obj.pa_tel);
$("#product_pa_originator").html(obj.pa_originator);
$("#product_pa_originatortel").html(obj.pa_originatortel);
$("#product_pa_fixedtel").html(obj.pa_fixedtel);
$("#product_pa_email").html(obj.pa_email);
$("#product_pa_postaladdr").html(obj.pa_postaladdr);
$("#product_pa_wxname").html(obj.pa_wxname);
// $("#product_pa_wximg").html(obj.pa_wximg);
$("#product_pa_preferential").html(obj.pa_preferential);
$("#product_pa_prefterm").html(obj.pa_prefterm);
$("#product_pa_preferentialdes").html(obj.pa_preferentialdes);
if(obj.pa_logoimg){
$("#product_pa_logoimg").attr("src","http://www.juejinfuhuaqi.com/"+obj.pa_logoimg);
}
if(obj.pa_companylicense){
$("#product_pa_companylicense").attr("src","http://www.juejinfuhuaqi.com/"+obj.pa_companylicense);
}
if(obj.pa_wximg){
$("#product_pa_wximg").attr("src","http://www.juejinfuhuaqi.com/"+obj.pa_wximg);
}
});
$("#show_model_shop").show();
});
控制器
/**
* 服务商申请详情
*/
public function providers()
{
$id = I('get.id');
$bpapplys = D('Providerapply')->selectOne($id);
if(0 == $bpapplys['is_status']){
$bpapplys['is_status'] = '待处理';
}elseif (1 == $bpapplys['is_status']){
$bpapplys['is_status'] = '已处理';
}else{
$bpapplys['bp_status'] = '未提交';
}
echo json_encode($bpapplys);
}
以上是可以完全展示出信息
二:不可以展示
以下换成post却不可以
/**
* 服务商申请详情
*/
public function providers()
{
$id = I('post.id');
$bpapplys = D('Providerapply')->selectOne($id);
if(0 == $bpapplys['is_status']){
$bpapplys['is_status'] = '待处理';
}elseif (1 == $bpapplys['is_status']){
$bpapplys['is_status'] = '已处理';
}else{
$bpapplys['bp_status'] = '未提交';
}
echo json_encode($bpapplys);
}
//显示查看详情信息
$(".shop_detail").click(function(){
var id = $(this).attr("tag");
$.post("/index.php/Admin/Providerapply/providers",{id:id},
function(data){
var obj = jQuery.parseJSON(data);
$("#product_pa_companyname").html(obj.pa_companyname);
// $("#product_pa_logoimg").html(obj.pa_logoimg);
$("#product_pa_companyabb").html(obj.pa_companyabb);
$("#product_pa_companysynopsis").html(obj.pa_companysynopsis);
$("#product_pa_business").html(obj.pa_business);
// $("#product_pa_companylicense").html(obj.pa_companylicense);
$("#product_pa_companynetwork").html(obj.pa_companynetwork);
$("#product_pa_name").html(obj.pa_name);
$("#product_pa_tel").html(obj.pa_tel);
$("#product_pa_originator").html(obj.pa_originator);
$("#product_pa_originatortel").html(obj.pa_originatortel);
$("#product_pa_fixedtel").html(obj.pa_fixedtel);
$("#product_pa_email").html(obj.pa_email);
$("#product_pa_postaladdr").html(obj.pa_postaladdr);
$("#product_pa_wxname").html(obj.pa_wxname);
// $("#product_pa_wximg").html(obj.pa_wximg);
$("#product_pa_preferential").html(obj.pa_preferential);
$("#product_pa_prefterm").html(obj.pa_prefterm);
$("#product_pa_preferentialdes").html(obj.pa_preferentialdes);
if(obj.pa_logoimg){
$("#product_pa_logoimg").attr("src","http://www.juejinfuhuaqi.com/"+obj.pa_logoimg);
}
if(obj.pa_companylicense){
$("#product_pa_companylicense").attr("src","http://www.juejinfuhuaqi.com/"+obj.pa_companylicense);
}
if(obj.pa_wximg){
$("#product_pa_wximg").attr("src","http://www.juejinfuhuaqi.com/"+obj.pa_wximg);
}
});
$("#show_model_shop").show();
});
三:又可以展示
/**
* 服务商申请详情
*/
public function providers()
{
$id = I('post.id');
$bpapplys = D('Providerapply')->selectOne($id);
if(0 == $bpapplys['is_status']){
$bpapplys['is_status'] = '待处理';
}elseif (1 == $bpapplys['is_status']){
$bpapplys['is_status'] = '已处理';
}else{
$bpapplys['bp_status'] = '未提交';
}
echo json_encode($bpapplys);
}
//显示查看详情信息
$(".shop_detail").click(function(){
var id = $(this).attr("tag");
$.post("/index.php/Admin/Providerapply/providers",{id:id},
function(data){
var obj = jQuery.parseJSON(data);
$("#product_pa_companyname").html(obj.pa_companyname);
// $("#product_pa_logoimg").html(obj.pa_logoimg);
$("#product_pa_companyabb").html(obj.pa_companyabb);
$("#product_pa_companysynopsis").html(obj.pa_companysynopsis);
$("#product_pa_business").html(obj.pa_business);
// $("#product_pa_companylicense").html(obj.pa_companylicense);
$("#product_pa_companynetwork").html(obj.pa_companynetwork);
$("#product_pa_name").html(obj.pa_name);
$("#product_pa_tel").html(obj.pa_tel);
$("#product_pa_originator").html(obj.pa_originator);
$("#product_pa_originatortel").html(obj.pa_originatortel);
$("#product_pa_fixedtel").html(obj.pa_fixedtel);
$("#product_pa_email").html(obj.pa_email);
$("#product_pa_postaladdr").html(obj.pa_postaladdr);
$("#product_pa_wxname").html(obj.pa_wxname);
// $("#product_pa_wximg").html(obj.pa_wximg);
$("#product_pa_preferential").html(obj.pa_preferential);
$("#product_pa_prefterm").html(obj.pa_prefterm);
$("#product_pa_preferentialdes").html(obj.pa_preferentialdes);
if(obj.pa_logoimg){
$("#product_pa_logoimg").attr("src","http://www.juejinfuhuaqi.com/"+obj.pa_logoimg);
}
if(obj.pa_companylicense){
$("#product_pa_companylicense").attr("src","http://www.juejinfuhuaqi.com/"+obj.pa_companylicense);
}
if(obj.pa_wximg){
$("#product_pa_wximg").attr("src","http://www.juejinfuhuaqi.com/"+obj.pa_wximg);
}
});
$("#show_model_shop").show();
});
总结:个人觉得是在写post的时候有使用了中文输入,但是切换成英文之后,正确输入还是有问题,最后的解决是赋值别的页面的post,做替换修改(此问题诡异)
正文完