开发者社区> 问答> 正文

Notice: Trying to get property of non求大神指导下?报错

一个简单的登录判断下post过来的用户名username和密码pwd否相同

$user = User::getByname(username);//查询到的时候为空会报错
if($user->username == $_POST['username'] && $user->pwd== $_POST['pwd'])

if(isset($user->username))//这样没事

但我想实现上面那个登录判断下post过来的用户名username和密码pwd否相同的逻辑

请问该怎样解决,不要说@了

展开
收起
爱吃鱼的程序员 2020-06-22 19:37:23 364 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    if($_POST['username']&&$user->username==$_POST['username']&&$user->pwd==$_POST['pwd'])

    这样行不

    2020-06-22 19:37:38
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载