Home  >  Article  >  Backend Development  >  php请教

php请教

WBOY
WBOYOriginal
2016-06-23 14:00:18929browse

$userMsg=$_POST['UserMsg'];  //ajax获取前台传递的对象
$userMsg->userName;//获取对象的属性

不知道 是不是这样写?求解?


回复讨论(解决方案)

print_r($_POST);
看看都有什么?

 Array
(
    [UserMsg] => [object Object]
    [Arr] => [object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
)

是Object

你的 js 代码?

除了 json 其他对象不可以被传递,应该是你哪里搞错了

//获取对象用户的信息
var userMsg=new Object();
userMsg.kecheng=kecheng;
userMsg.company=company;

这个是我传递的js对象


是不是  我把这个对象  json转换下     php后台就能认识呢?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn