>  기사  >  백엔드 개발  >  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:331162검색

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으로 문의하세요.