ホームページ  >  記事  >  バックエンド開発  >  Catchable fatal error: Object of class dUser could not be converted to string in on line 16解决方案

Catchable fatal error: Object of class dUser could not be converted to string in on line 16解决方案

WBOY
WBOYオリジナル
2016-06-13 10:11:331165ブラウズ

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的错误。不知道是哪里的问题,请大家帮忙指导。谢谢!!!


PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phpclass 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;     }}?>


------解决方案--------------------
参数$name被带入了一个类dUser变量.
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。