致命错误:无法在写入上下文中使用函数返回值
为什么我的代码中出现以下错误?
致命错误:无法在....中的写入上下文中使用函数返回值。
II在if ... else内部有return语句,当我第一次开始使用这个函数时,这个错误看起来像是一个与return语句有关的错误。 但我用echo声明替换了它们,而且我仍然收到错误,所以我不知道发生了什么。 任何帮助或建议?
public function wallPostComments() {
// This function processes wall post comments
// pull the submitted comment data
$returnedPostId = $this->inuput->post('entryId');
$returnedCommentData = $this->input->post('returnedCommentData');
// pull the required session data
$userid = $this->session->userdata('userid');
// select the sql data from wallPosts and wallPostComments
$query = $this->db->query("SELECT * FROM wallPosts, wallPostComments");
// loop through the mysql rows and process the expanded sql code
foreach ($query->result() as row()) {
if($row->idwallPosts == $JSONedIdWallPosts) {
echo "success";
} else {
echo "failure";
}
}
}
row()
是什么时候变成函数的?
尝试:
foreach ($query->result() as $row) {
链接地址: http://www.djcxy.com/p/69247.html
上一篇: Fatal error: Can't use function return value in write context in
下一篇: Fatal error: Can't use function return value in write context