我正在使用 CI IPN 库,就它们的功能而言,一切运行顺利,所有 txn 信息都提交给数据库,这意味着脚本被调用并运行。但是,当我尝试在成功的 txn 的情况下添加我自己的指令时 - 即向客户发送电子邮件并将他的详细信息添加到数据库 - 它完全忽略了我的代码。我试图删除“如果成功”的条件,它仍然不起作用。重要的是要注意,当我通过来自另一个控制器的直接调用在 IPN 控制器之外运行这些模型时,它们运行良好。这是代码:
class Ipn extends CI_Controller {
// To handle the IPN post made by PayPal (uses the Paypal_Lib library).
public function index()
{
$this->load->library('PayPal_IPN'); // Load the library
// Try to get the IPN data.
if ($this->paypal_ipn->validateIPN())
{
// Succeeded, now let's extract the order
$this->paypal_ipn->extractOrder();
// And we save the order now
$this->paypal_ipn->saveOrder();
// Now let's check what the payment status is and act accordingly
if ($this->paypal_ipn->orderStatus == PayPal_IPN::PAID)
{
$this->load->model("register_model"); // my own code
$this->register_model->insert(); // my own code
$this->register_model->email_customer(); //my own code
} // end if PAID
}
else // Just redirect to the root URL
{
$this->load->helper('url');
redirect('/', 'refresh');
} // end if validates
} // end function
} // end class
TIA 为您提供帮助。马塔尼亚