我在施工中称之为。
function __construct()
{
parent::__construct();
if( !$this->authentication->authenticate( $this->router->class ) ) {
redirect('clients/');
}
$this->load->model('client_model', 'client');
$this->layout = 'layout/web/client';
}
当paypal NOTIFY_URL点击url时,我遇到问题,它不保存凭证,如果我从构造函数中删除它,它就可以工作。
function payment_notification()
{
if( $this->input->post(NULL, TRUE) )
{
$this->saveintodb( $this->input->post() );
} else {
show_error('Post data not found in request', 500);
}
}
答案 0 :(得分:0)
这里提供的信息不够......!
<强> CONFIG.PHP 强>
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| Check to see if the request uri contains paypal
|--------------------------------------------------------------------------
*/
if( stripos($_SERVER["REQUEST_URI"],'/paypal') )
{
$config['csrf_protection'] = FALSE;
}
- 的 routes.php文件强>
$route['paypal/notify'] = 'paypal/recieve_notification'; // www.mysite.com/paypal/notify
- 的控制器/ Paypal.php 强>
class Paypal extends CI_Controller{
public function __construct(){ parent::__construct(); }
public function recieve_notification() //simplified function
{
try(
if( !$_POST )
throw new Exception('No POST data recieved from Paypal');
if( $_POST['verified'] !== 'VERIFIED') //im guessing here
throw new Exception('User not verified by paypal');
)catch(Exception $e){
//debugging: show_error($e->getMessage());
log_message('error', $e->getMessage());
redirect('/');
exit;
}
//Save to DB
$this->saveintodb( $_POST ); //expecting Exception thrown from DB ?
$this->session->flashdata('success', 'Data Saved!');
redirect('/');
}
}