【发布时间】:2016-01-26 05:48:41
【问题描述】:
我在 Angular 中的表单中有以下帖子:
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
@$id = $request->id;
@$cid = $request->cid;
@$description = $request->description;
@$type = $request->type;
@$owner = $request->owner;
@$ssamount = $request->ssamount;
if($owner == 'spouse' && $type == 'ira')
{$exempt == 'yes'};
if(mysqli_connect_errno()) { Etc...
我想要完成的是在 PHP 中而不是客户端中放置一些逻辑。如果 Angular JSON 发布文件中的两个变量与所示条件匹配,我希望将 MYSQL 数据库中的另一个字段设置为是或否。 $exempt 在上面。
我没有收到任何错误,但它不会更改 MYSQL 中的字段。我认为问题可能与解码后的 JSON 的结构有关,或者我可能必须在解码之前将此 JSON 对象添加到 $postdata。
有什么想法吗?谢谢
【问题讨论】:
-
这失败了
{$exempt == 'yes'};有两个原因。