Hướng dẫn how to fetch data from object in php - cách lấy dữ liệu từ đối tượng trong php

Làm thế nào tôi có thể lấy user_nicename từ đối tượng này?

BP_User Object
(
    [data] => stdClass Object
        (
            [ID] => 1
            [user_login] => NICENICE
            [user_pass] => $P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5.
            [user_nicename] => NICENAME
            ...

Và tôi có thể tìm tài nguyên để tìm hiểu điều này ở đâu?

Hướng dẫn how to fetch data from object in php - cách lấy dữ liệu từ đối tượng trong php

ajreal

46.2K10 Huy hiệu vàng86 Huy hiệu bạc119 Huy hiệu đồng10 gold badges86 silver badges119 bronze badges

Hỏi ngày 8 tháng 12 năm 2010 lúc 21:46Dec 8, 2010 at 21:46

2

$variable->data->user_nicename

nên làm việc.

Đã trả lời ngày 8 tháng 12 năm 2010 lúc 21:47Dec 8, 2010 at 21:47

Hướng dẫn how to fetch data from object in php - cách lấy dữ liệu từ đối tượng trong php

PekkapekkaPekka

436K139 Huy hiệu vàng966 Huy hiệu bạc1082 Huy hiệu Đồng139 gold badges966 silver badges1082 bronze badges

2

Bạn cũng có thể in bằng cách khác

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }

Kết quả sẽ được

name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME

Đã trả lời ngày 23 tháng 1 năm 2015 lúc 11:07Jan 23, 2015 at 11:07

Shiv Singhshiv SinghShiv Singh

6.6703 Huy hiệu vàng39 Huy hiệu bạc49 Huy hiệu đồng3 gold badges39 silver badges49 bronze badges

12 năm trước

Chris tại r3i chấm nó ¶Fetch a result row as an object

15 năm trước

Rodolphe Dot Bodeau tại miễn phí dot fr ¶(resource $result, string $class_name = ?, array $params = ?): object

thông tin [at] woeiweb [dot] nl ¶

Trithaithus tại tibiahumor dot net ¶

17 năm trướcresource that is being evaluated. This result comes from a call to mysql_query().

Justin Rovang

backglancer tại hotmail ¶stdClass object is returned.

hcse tại op dot pl ¶

Danielpunt ¶array of parameters to pass to the constructor for class_name objects.

cú pháp ¶

16 năm trướcobject with string properties that correspond to the fetched row, or

$variable->data->user_nicename
2 if there are no more rows.

rcoles tại hotmail dot com

19 năm trướcmysql_fetch_object() example

$variable->data->user_nicename
3

Qmysql_fetch_object() example

$variable->data->user_nicename
4

18 năm trước

Federico tại Pomi Dot Net: Performance

20 năm trướcmysql_fetch_array(), and almost as quick as mysql_fetch_row() (the difference is insignificant).

strrev xc.noxeh@ellij ¶:

Eskil Kvalnes ¶ is similar to mysql_fetch_array(), with one difference - an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their offsets (numbers are illegal property names).

Spamme at aol dot com ¶: Field names returned by this function are case-sensitive.

Lưu ý: Hàm này đặt các trường NULL thành giá trị PHP

$variable->data->user_nicename
5.: This function sets NULL fields to the PHP
$variable->data->user_nicename
5
value.

Xem thêm

  • mysql_fetch_array () - lấy hàng kết quả như một mảng kết hợp, một mảng số hoặc cả hai
  • mysql_fetch_assoc () - lấy hàng kết quả như một mảng kết hợp
  • mysql_fetch_row () - Nhận một hàng kết quả như một mảng được liệt kê
  • mysql_data_seek () - di chuyển con trỏ kết quả nội bộ
  • mysql_query () - Gửi truy vấn MySQL

MP ¶

14 năm trước

$variable->data->user_nicename
6

$variable->data->user_nicename
7

$variable->data->user_nicename
8

$variable->data->user_nicename
9

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
0

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
1

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

Peter t ¶

14 năm trước

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
3

Peter t ¶

quản trị trang web tại Kibab dot com ¶

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
4

12 năm trước

Chris tại r3i chấm nó ¶

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
5

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
6

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
7

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
8

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
9

name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME
0

name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME
1

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

15 năm trước

Chris tại r3i chấm nó ¶

name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME
3

name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME
4

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

15 năm trước

Chris tại r3i chấm nó ¶

name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME
6

name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME
7

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

Trithaithus tại tibiahumor dot net ¶

17 năm trước

name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME
9

user_nicename0

user_nicename1

user_nicename2

Justin Rovang

14 năm trước

user_nicename3

user_nicename4

user_nicename5

user_nicename6

user_nicename7

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

backglancer tại hotmail ¶

17 năm trước

user_nicename9

$result0

$result1

$result2

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

Justin Rovang

14 năm trước

$result4

$result5

$result6

backglancer tại hotmail ¶

14 năm trước

$result7

$result8

$result9

$class_name0

backglancer tại hotmail ¶

hcse tại op dot pl ¶

$class_name1

$class_name2

$class_name3

$class_name4

$class_name5

$class_name6

$class_name7

$class_name8

$class_name9

$params0

$params1

$params2

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

Danielpunt ¶

cú pháp ¶

$params4

$params5

$params6

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

16 năm trước

rcoles tại hotmail dot com

$params8

$params9

result0

result1

result2

result3

result4

result5

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

19 năm trước

Q

result7

result8

result9

class_name0

class_name1

class_name2

class_name3

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

18 năm trước

14 năm trước

class_name5

class_name6

class_name7

class_name8

class_name9

$variable->data->user_nicename
00

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

backglancer tại hotmail ¶

cú pháp ¶

$variable->data->user_nicename
02

16 năm trước

cú pháp ¶

$variable->data->user_nicename
03

$variable->data->user_nicename
04

$variable->data->user_nicename
05

$variable->data->user_nicename
06

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

16 năm trước

hcse tại op dot pl ¶

$variable->data->user_nicename
08

$variable->data->user_nicename
09

$variable->data->user_nicename
10

$variable->data->user_nicename
11

$variable->data->user_nicename
12

$variable->data->user_nicename
13

Danielpunt ¶

cú pháp ¶

$variable->data->user_nicename
14

$variable->data->user_nicename
15

$variable->data->user_nicename
16

$variable->data->user_nicename
17

$variable->data->user_nicename
18

$variable->data->user_nicename
19

class_name2

$variable->data->user_nicename
21

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

16 năm trước

cú pháp ¶

$variable->data->user_nicename
23

$variable->data->user_nicename
24

$variable->data->user_nicename
25

$variable->data->user_nicename
26

$variable->data->user_nicename
27

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

16 năm trước

Q

$variable->data->user_nicename
29

$variable->data->user_nicename
30

$variable->data->user_nicename
31

$variable->data->user_nicename
32

$variable->data->user_nicename
33

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

18 năm trước

cú pháp ¶

$variable->data->user_nicename
35

$variable->data->user_nicename
36

$variable->data->user_nicename
37

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2

16 năm trước

hcse tại op dot pl ¶

$variable->data->user_nicename
39

$variable->data->user_nicename
40

$variable->data->user_nicename
41

$variable->data->user_nicename
42

$variable->data->user_nicename
43

$variable->data->user_nicename
44

$variable->data->user_nicename
45

foreach($result->data as $newdata) //$result is variable that store raw data 
{
printf("name: %s, Pass: %s, nicename: %s 
", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); }
2