gpt4 book ai didi

php - 在 PHP 中使用 PDO 的正确方法是什么?

转载 作者:行者123 更新时间:2023-12-04 06:54:51 24 4
gpt4 key购买 nike

一个来自 here :

$sth->execute(array(':calories' => $calories, ':colour' => $colour));

另一个来自 here :
/*** reassign the variables again ***/
$data = array('animal_id'=>4, 'animal_name' => 'bruce');

/*** execute the prepared statement ***/
$stmt->execute($data);

我的问题是: :keykey ?

抱歉我这里没有PHP环境。

最佳答案

两者都有效,但是 鼓励您使用 :key 符号,因为它可以防止一些错误,例如,如果您使用保留关键字命名变量...

关于php - 在 PHP 中使用 PDO 的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2675627/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com