users" );$wpdb是一个实例,$wpdb = new wpdb( DB_U"/> users" );$wpdb是一个实例,$wpdb = new wpdb( DB_U">
Home > Backend Development > PHP Tutorial > PHP的实例化对象的成员变量有关问题

PHP的实例化对象的成员变量有关问题

WBOY
Release: 2016-06-13 11:48:03
Original
1124 people have browsed it

PHP的实例化对象的成员变量问题

<br />$user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" );<br />
Copy after login


$wpdb是一个实例,$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );但是$wpdb类里面根本就没有users这个成员,但很多程序都可以这样写,这是php的一个什么特性?

------解决方案--------------------
不可能的!
users 属性一定是在哪里赋过值的,因为 $wpdb->users 是作为表名出现的,如果不赋值就错了
------解决方案--------------------
实例化$wpdb的类里面应该是有个__set(){}魔术方法的

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template