为什么我在数据库中看到alex1而不是alex? [英] Why I am seeing alex1 instead of alex which is in database?
问题描述
我使用此代码
I use this code
public function home(){
echo $user = User::find(1)->username;
echo '<pre>' , print_r($user), '
';
返回视图('hello');
}
我在浏览器上看到这个
[ ^ ]
这是我的数据库图片。我正在使用亚历克斯。
http://tinypic.com/r/2py9ekx/9 [ ^ ]
那么,为什么我在浏览器的第一个结果中看到alex1?
';
return view('hello');
}
I see this on my browser
[^]
This is my database image. I am using alex.
http://tinypic.com/r/2py9ekx/9[^]
So, why should i see alex1 in first result on my browser?
推荐答案
user = User :: find(1) - >用户名;
echo'< pre>' ,print_r(
user = User::find(1)->username; echo '<pre>' , print_r(
user),'
';
返回视图('hello') ;
}
我在浏览器上看到这个
[ ^ ]
这是我的数据库图像。我正在使用亚历克斯。
http://tinypic.com/r/2py9ekx/9 [ ^ ]
那么,为什么我在浏览器的第一个结果中看到alex1?
';
return view('hello');
}
I see this on my browser
[^]
This is my database image. I am using alex.
http://tinypic.com/r/2py9ekx/9[^]
So, why should i see alex1 in first result on my browser?
因为你是echo
- 完成作业打印后print_r()
的返回值
Because you'reecho
-ing the return value ofprint_r()
after it has done its job printing
这篇关于为什么我在数据库中看到alex1而不是alex?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!