本文介紹了在 PHP 中使用 PDO 綁定十進(jìn)制/雙精度/浮點值的最佳方法是什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
看起來類常量僅涵蓋用于綁定的PDO::PARAM_BOOL
、PDO::PARAM_INT
和PDO::PARAM_STR
.你只是將十進(jìn)制/浮點數(shù)/雙精度值綁定為字符串還是有更好的方法來處理它們?
It appears the class constants only cover PDO::PARAM_BOOL
, PDO::PARAM_INT
and PDO::PARAM_STR
for binding. Do you just bind decimal / float / double values as strings or is there a better way to treat them?
MySQLi 允許將 'd' 類型用于 double,令人驚訝的是 PDO 在許多其他方面似乎更好時沒有等效項.
MySQLi allows the 'd' type for double, it's surprising that PDO doesn't have an equivalent when it seems better in so many other ways.
推薦答案
AFAIK PDO::PARAM_STR 是要走的路.
AFAIK PDO::PARAM_STR is the way to go.
這篇關(guān)于在 PHP 中使用 PDO 綁定十進(jìn)制/雙精度/浮點值的最佳方法是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!