Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对于此查询: $sql='select col from table where other_col=?';
$sql='select col from table where other_col=?';
我目前正在获取返回的数据,如下所示: $data=$statement->fetch()['col'];
$data=$statement->fetch()['col'];
这对我来说看起来不太好。有没有更好的方法来做到这一点,或者就这样好吗?
你可以试试 :
$data=$statement->fetchColumn(0);