<?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" } 這個是運行結果,各位大神求解答