Notice: Tryingtogetpropertyofnon: ask the gods to guide the next simple logon to determine whether the username and password pwd from post are the same
$ User = User: getByname (username); // if it is null, an error is returned.
If ($ user-> username =$ _ POST ['username'] & $ user-> pwd ==$ _ POST ['pwd'])
However
If (isset ($ user-> username) // It's okay
However, I want to implement the above login logic to determine whether the username and password pwd from post are the same
What should I do? don't say @
Reply to discussion (solution)
If ($ _ POST ){
$ User = User: getByname ($ _ POST ['username']);
If ($ user-> username =$ _ POST ['username'] & $ user-> pwd ==$ _ POST ['pwd'])
....
First, check whether you have clicked to log on.
If (isset ($ _ POST ['submit ']) {
If ($ user-> username =$ _ POST ['username'] & $ user-> pwd ==$ _ POST ['pwd']) {
}
}
In this way, no error is reported if the user has no value.