MySQLi-不允许属性访问 [英] MySQLi - property access is not allowed yet

查看:115
本文介绍了MySQLi-不允许属性访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试关闭mysqli连接时,我收到此警告尚未允许属性访问".为什么?

Im' getting this warning "property access is not allowed yet" when trying to close mysqli connection. WHY?

$mysqli = new mysqli ( $database ["dbUri"], $database ["dbUserName"], $database ["dbPassword"], $database ["dbSchema"], $database ["dbPort"] );
$mysqli->autocommit(FALSE);
$con = $mysqli;
$rowsAffected = /* completes insert using $con */;
if ($rowsAffected==0) {
    throw new Exception("Insert of new record failed");
}
$insertId = $con->insert_id;
$con->commit();
$con->close();

顺便说一句,插入成功,并且我在$ insertId中具有正确的值.提交也可以很好地工作,但是正是关闭触发了警告.

BTW, the insert is successful and I have the correct value in $insertId. Commit works well too, but it's the close that triggers the warning.

我将代码隐藏在/* completes insert using $con */部分中,因为它又长又无关紧要(sql可以工作).因此,除非您认为这是相关的,否则我只包括其余部分.

I hid the code in /* completes insert using $con */ section as it is long and irrelevant (the sql works). So unless you think it is relevant I only included the rest.

我看过类似的问题,但其他帖子提到未建立连接.但是,我的连接有效.请注意插入成功"的要点.

I looked at similar questions but other posts refer to the connection not being established. However, my connection works. PLEASE see the point about "insert is successful".

推荐答案

就我对此间歇性问题的分析得出的结论(至少对于我而言),这是mysqli扩展或PHP中的某种错误.调试器(XDebug),因为它仅在我断点/单步执行程序时发生,而不是在页面渲染完成之前简单地运行相同代码而没有断点/单步执行任何代码时发生.

As far as my analysis of this intermittent problem has concluded (at least in my case), this is some kind of bug in either the mysqli extension or the PHP debugger (XDebug), since it only happens when I breakpoint/single-step the program, but not when simply running the same code without breakpointing/single-stepping any code before the page rendering has completed.

如果在页面渲染完成之前没有断点或单步执行任何代码,对您来说仍然会发生吗?

Does it still happen for you if you don't breakpoint or single-step any code before the page rendering is complete?

这篇关于MySQLi-不允许属性访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆