Catchable fatal error: Object of class dUser could not be converted to string in on line 16
当运行getUserByName时,提示:Catchable fatal error: Object of class dUser could not be converted to string in on line 16的错误。不知道是哪里的问题,请大家帮忙指导。谢谢!!!
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><?php
class dUser
{
public function newpdo() {
global $dbinfo;
$dsn = "mysql:host={$dbinfo['host']};port={$dbinfo['port']};dbname={$dbinfo['dbname']}";
$pdo = new PDO($dsn, $dbinfo['user'], $dbinfo['pwd'], array(PDO::ATTR_PERSISTENT => true));
return $pdo;
}
public function getUserByName(&$info, $name) {
$dbpdo = $this->newpdo();
$sql = "SELECT * FROM `usermember` WHERE `user`=?";
$st = $dbpdo->prepare('SELECT * FROM `usermember` WHERE `user`=?');
$bRet = $st->execute(array($name));
$info = $st->fetch(PDO::FETCH_ASSOC);
return $bRet;
}
}
?>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号