我问这个的原因是我对我想传递给下一个视图的一个愚蠢的小消息感到生气。所以如果我这样做:
if(!$this->paypal_pro->APICallSuccessful($PayPalResult['ACK']))
{
var_dump($PayPalResult['ERRORS']);
$message=array();
foreach ($PayPalResult['ERRORS'] as $row => $error){
// $message['flashError'][$row]['L_SHORTMESSAGE'] = $error['L_SHORTMESSAGE'];
$message['flashError'][$row]['test'] = "The Session class permits you maintain a user's";
// $message['flashError'][$row]['L_ERRORCODE'] = $error['L_ERRORCODE'];
// $message['flashError'][$row]['L_LONGMESSAGE'] = $error['L_LONGMESSAGE'];
}
// print_r($message);
$this->session->set_flashdata($message);
redirect('main/Form');
}
它工作得很好,但如果我这样做:
if(!$this->paypal_pro->APICallSuccessful($PayPalResult['ACK']))
{
var_dump($PayPalResult['ERRORS']);
$message=array();
foreach ($PayPalResult['ERRORS'] as $row => $error){
// $message['flashError'][$row]['L_SHORTMESSAGE'] = $error['L_SHORTMESSAGE'];
$message['flashError'][$row]['test'] = "The Session class permits you maintain a user's and track their activity while";
// $message['flashError'][$row]['L_ERRORCODE'] = $error['L_ERRORCODE'];
// $message['flashError'][$row]['L_LONGMESSAGE'] = $error['L_LONGMESSAGE'];
}
// print_r($message);
$this->session->set_flashdata($message);
redirect('main/Form');
}
它不起作用。
我在这里以 main/form 显示 falshdata:
<?php if($this->session->flashdata('flashError')):?>
<div class='flashError'>
<?php
print_r($this->session->flashdata('flashError'));
?>
</div>
<?php endif?>
您可以猜到我正在尝试将 Payal 的错误消息拉到视图中以进行错误处理。谢谢