![](/img/trans.png)
[英]Why is my variable corrupting as I pass it from Controller to Model in Codeigniter
[英]How do I pass a variable form my model to my controller?
我正在使用Zend Framework2。以下是我的模型代碼(FriendCallTable):
$this->tableGateway->insert($data);
return $id= $this->tableGateway->lastInsertValue;
下面是我的控制器代碼:
$id = $this->FriendCallTable->id;
echo $id;
如果我在模型中回聲而不是返回值,那么我將獲得正確的值。 我不知道如何通過它。 感謝您的幫助和指導。
我需要在控制器中執行以下操作:
$id = $this->getFriendCallTable()->saveFriendCall($friendCall);
這是您需要做的:
return $this->tableGateway->lastInsertValue;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.