引用一个类的属性和方法就使用->符号。
->是调用的意思
类 -> 类的成员变量或者成员函数
如果得到的结果是对象的话就用-> 名称 来输出内容
如果得到的结果是数组的话就用 myarray[] 来输出
程序:
while ($property = mysql_fetch_field($row))
{
print_r($property);
echo "Field name: " . $property->name . "<br />";
}
while($rs=mysql_fetch_array($row)){
echo $rs[0];
print_r($rs);
}
执行结果:
stdClass Object
(
[name] => id
[table] => list
[def] =>
[max_length] => 7
[not_null] => 1
[primary_key] => 1
[multiple_key] => 0
[unique_key] => 0
[numeric] => 0
[blob] => 0
[type] => string
[unsigned] => 0
[zerofill] => 0
)
stdClass Object
(
[name] => content
[table] => list
[def] =>
[max_length] => 6
[not_null] => 0
[primary_key] => 0
[multiple_key] => 0
[unique_key] => 0
[numeric] => 0
[blob] => 1
[type] => blob
[unsigned] => 0
[zerofill] => 0
)
Array
(
[0] => 35list1
[id] => 35list1
[1] => 测试
[content] => 测试
[2] =>
[writedate] =>
)
Array
(
[0] => abck
[id] => abck
[1] => 中国
[content] => 中国
[2] =>
[writedate] =>
)