php中的"属性"与"方法"有什么区别?多谢!
解决方案 »
- 新手提问,搞不懂布尔型。。
- 正则表达式,字符串前不包括 某特定字符
- php 操作二进制数据的问题!
- 请问有人做过用html转PDF的类 在google能找到的我都找过了.
- 如何自动生成下载链接
- 正则表达式:(?1)这表示什么呢?出自Gdj(陈水)写的#(?=(<table(?:(?:[^<]|<(?!table))*?|(?1))*</table>))#is
- 谁知道这个技术??adodb+smarty+myClass 结合-数据类的智能操作
- 求一个正则表达式,用PHP实现
- 请问哪里有免费的支持PHP+APACHE+MYSQL的个人空间?我都搜索不到有真正免费的呀!
- 为何我的iis服务器上的php一浏览总说没有权限
- 问个初学者的关于数组的问题
- 关于LINUX下PHP生成中文图片 乱码问题高手进。。
方法就是 eg. ML
懂了吧!!!!!!
* Get a result row as an enumerated array
* @link http://www.php.net/manual/en/mysqli-result.fetch-row.php
* @return mixed mysqli_fetch_row returns an array of strings that corresponds to the fetched row
* or &null; if there are no more rows in result set.
*/
public function fetch_row () {} //$result->fetch_row();
/**属性
* Get the number of fields in a result
* @link http://www.php.net/manual/en/mysqli-result.field-count.php
* @param result mysqli_result
* @return int The number of fields from a result set.
*/
public function field_count (mysqli_result $result) {}//$rs->field_count;
fetch_row 和 field_count 都是方法function 本意是功能
首先由数学界引入,译为 函数
所以计算机界也就沿用至今为了区别其在类中的不同,所以在类中的 function 被译为 方法变量和属性 也是如此
谁让汉语言博大精深呢
fetch_row 和 field_count 都是方法,我就是想明白这点,那为什么调用的时候如下:
echo "结果数据表里数据列个数为:".$rs->field_count."列<br>"; //没括号-属性
echo "默认当前指针的位置第:".$rs->current_field."列<br>";while(list($uid,$name,$departmentId) = $result->fetch_row()){} ////有括号-方法
???但你并没有贴全那些代码呀,我怎么知道你遇到了什么问题呢?