<?php try{ $pdo = new PDO("mysql:127.0.0.1:3306;dbname='blogs';charset=utf8mb4",'root',''); echo "pdo连接成功".""; }catch(Exception $e){ echo $e->getMessage(); } $str = $pdo->prepare("SELECT * from user"); foreach ($str as $item){ echo $item; }
都显示连接成功了,结果却是直接显示了MySQL语句
移动用户-15473902020-11-15 18:13:50
pdo连接成功 object(PDOStatement)#2 (1) { ["queryString"]=> string(18) "SELECT * from user" } 这个是运行结果,各位大神求解答