【问题标题】:PostageApp emails,have they been sentPostageApp 电子邮件,是否已发送
【发布时间】:2012-08-29 05:21:58
【问题描述】:

使用 PHP 如何获得返回状态。消息是否已收到。我找到了这个文档,但是在使用 PHP 时它不是很有帮助:

http://blog.postageapp.com/tag/php/

我不确定,但这是否有效:

if($this->postageapp->send()==true){ # returns JSON response from the server

//do something, 

}else{

//otherwise

}

谢谢

【问题讨论】:

  • var_dump($this->postageapp->send()) 与成功和不成功的尝试结合使用。

标签: php postageapp


【解决方案1】:

无论调用成功与否,send 方法都会返回一个 JSON 对象。我认为 PHP 总是将这个返回值评估为 true。

因此,您需要检查返回的对象。

$retVal = $this->postageapp->send();
$success = retVal->response->status == 'ok';

【讨论】:

    猜你喜欢
    • 2016-09-22
    • 1970-01-01
    • 1970-01-01
    • 2018-09-13
    • 1970-01-01
    • 2014-07-25
    • 2020-01-14
    • 2011-09-22
    • 1970-01-01
    相关资源
    最近更新 更多