[请益] 一样的code却一直出错

楼主: supertsao (Lawrence)   2019-08-31 20:56:36
public function bind($param,$value,$type = null){
if(is_null($type)) {
switch (true) {
case is_int($value):
$type=PDO::PARAM_INT;
break;
case is_bool($value):
$type=PDO::PARAM_BOOL;
break;
case is_null($value):
$type=PDO::PARAM_NULL;
break;
default:
$type=PDO::PARAM_STR;
}
}
$this->stmt>bindValue($param, $value, $type);
}
// public function bind($param, $value, $type = null){
// if(is_null($type)){
// switch(true){
// case is_int($value):
// $type = PDO::PARAM_INT;
// break;
// case is_bool($value):
// $type = PDO::PARAM_BOOL;
// break;
// case is_null($value):
// $type = PDO::PARAM_NULL;
// break;
// default:
// $type = PDO::PARAM_STR;
// }
// }
// $this->stmt->bindValue($param, $value, $type);
// }
找到七笑 非常神奇 上面照着老师讲解的打出错
Uncaught Error: Call to undefined function bindValue() in
C:\xampp\htdocs\shareposts\app\libraries\Database.php:58 Stack trace: #0
C:\xampp\htdocs\shareposts\app\models\User.php(15): Database->bind(':email',
'[email protected]') #1 C:\xampp\htdocs\shareposts\app\controllers\Users.php(28):
User->findUserByEmail('[email protected]') #2
C:\xampp\htdocs\shareposts\app\libraries\Core.php(45): Users->register() #3
C:\xampp\htdocs\shareposts\public\index.php(4): Core->__construct() #4 {main}
thrown in C:\xampp\htdocs\shareposts\app\libraries\Database.php on line 58
直接贴老师付的CODE(下面注释掉的)却完全没问题 但是参照了半天还是找不到哪有问题
? 有没有人可以帮我看下><
作者: smallblock (純真 善良 模範生)   2019-08-31 21:11:00
$this->stmt>bindValue
作者: LPH66 (-6.2598534e+18f)   2019-09-01 01:27:00
-> 少打了一个减号变成 >
楼主: supertsao (Lawrence)   2019-09-01 01:50:00
...还真是 1楼写出来了我还没抓到>< 感谢楼上2位帮忙
作者: joejoe14758 (KILE)   2019-09-01 10:52:00
https://reurl.cc/Qpn8qq顺便看一下箭头的意思吧
作者: bakedgrass (蒙古烤小草)   2019-09-02 07:10:00
在说两个code完全一样以前先用winmerge之类的软件确认过再说吧

Links booklink

Contact Us: admin [ a t ] ucptt.com