PHP获得当前登录用户ID
获取用户信息,首先是根据条件来查找用户$_SERVER["user_id"] 登陆保存user_id保存到session$_SERVER["user"] 登陆保存用户到session*/"select * from user where id='".$_SERVER["user_id"]."' and user ='".$_SERVER["user"]."'" ; /*更新用户信息首先是要查找出这个用户信息查找的时候必须传递id参数过去,否则无法找到对应的用户*/"select * from user where id='".$_GET["user_id"]."'" ; // 可以不用根据id来做判断,但是判断的内容必须是唯一的/*最后修改完信息后通过表单提交的内容也要带能唯一识别用户的参数,(例如:id)*/"update user set face='".$_POST["user_icon"]."' where id='".$_POST["user_id"]."'"
浙公网安备 33010602011771号