php中的"属性"与"方法"有什么区别?多谢!
解决方案 »
- 含泪跪求--php调用system命令,shell可以成功运行,通过浏览器却不行
- PHP flv截图问题
- php循环读取xml(远程)数据?
- 字符串提取问题
- phpeclipse:the selection cannot be launched
- php+mysql 数据库中文乱码???怎么回事啊,急急!!!!!!!!!!!
- 怎么这么少人用haep类型的表啊?资料找到不多。要注意些什么?
- 可是输入我自己的IP却不行?
- 一个简单的问题,像ASP.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()){} ////有括号-方法
???但你并没有贴全那些代码呀,我怎么知道你遇到了什么问题呢?