非静态方法mysqli :: init()不能被静态调用 [英] Non-static method mysqli::init() cannot be called statically
本文介绍了非静态方法mysqli :: init()不能被静态调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
http://php.net/manual/en/mysqli.init.php
$ConnectionResource = mysqli::init();
上面的代码失败,并显示以下信息:
The above code fails with:
致命错误:非静态方法mysqli :: init()不能被静态调用
Fatal error: Non-static method mysqli::init() cannot be called statically
怎么来?
推荐答案
那只是手册中使用的愚蠢表示法,显然他们使用class->property
和class::method
而不考虑实际语言及其实例和类之间的区别-成员访问(->
与::
).请参见 http://www.php.net/manual/en上的示例1 /mysqli.real-connect.php
that's just stupid notation used in the manual, obviously they use class->property
and class::method
without regard for the actual language and its distinction between instance- and class-member access (->
vs. ::
). see example 1 at http://www.php.net/manual/en/mysqli.real-connect.php
这篇关于非静态方法mysqli :: init()不能被静态调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文